Repository navigation
Measure peak memory on Linux without the script's own - #117
Merged
Merged
Conversation
On Linux the kernel keeps a process's RSS high-water mark across exec, so a command forked from the benchmark script counted the script's own memory in its peak: every command under 20 to 30 MB showed the size of the Python process. On the workstation, samtools idxstats on the BAM showed 22 MB in one run and 30 MB in another; it takes 10 MB. On Linux the script now compiles a small C helper into WORK/tools, which forks the command from its own 1.4 MB process and reports its wall time, CPU time, peak RSS and exit status, as GNU time does. macOS keeps the peak physical footprint, which was not affected. PROTOCOL becomes 2, because memory in Linux reports of protocol 1 is not comparable. Output of a command that is not valid UTF-8 no longer stops the script: sh() and check_call() replace the bytesh() y cannot decode. The table of sizes by field shows "new" or "gone" for a field under 1% of its size on the other side, where it printed +113495.9% for qualblock. Checked on the workstation (Xeon E5-2690 v4, Ubuntu 24.04, --pin 0) with --input small between acb8904 and 5b61106: all checks pass, and samtools idxstats and flagstat on the BAM now peak at 10 MB, samtools view -h at 12 MB. On macOS the measuring path gives the same numbers as before.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #117 +/- ##
========================================
Coverage 88.69% 88.69%
========================================
Files 25 25
Lines 3220 3220
Branches 1103 1103
========================================
Hits 2856 2856
Misses 194 194
Partials 170 170
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Linux the kernel keeps a process's RSS high-water mark across exec, so a command forked from the benchmark script counted the script's own memory in its peak: every command under 20 to 30 MB showed the size of the Python process. On the workstation, samtools idxstats on the BAM showed 22 MB in one run and 30 MB in another; it takes 10 MB.
On Linux the script now compiles a small C helper into WORK/tools, which forks the command from its own 1.4 MB process and reports its wall time, CPU time, peak RSS and exit status, as GNU time does. macOS keeps the peak physical footprint, which was not affected. PROTOCOL becomes 2, because memory in Linux reports of protocol 1 is not comparable.
Output of a command that is not valid UTF-8 no longer stops the script: sh() and check_call() replace the bytesh() y cannot decode. The table of sizes by field shows "new" or "gone" for a field under 1% of its size on the other side, where it printed +113495.9% for qualblock.
Checked on the workstation (Xeon E5-2690 v4, Ubuntu 24.04, --pin 0) with --input small between acb8904 and 5b61106: all checks pass, and samtools idxstats and flagstat on the BAM now peak at 10 MB, samtools view -h at 12 MB. On macOS the measuring path gives the same numbers as before.