Change sampling interval to 1ms for better accuracy
- Changed from 10ms to 1ms sampling interval - Better captures data for fast programs - Memory already sampled in bytes for consistency - Will provide more detailed timeline data
This commit is contained in:
+2
-2
@@ -78,7 +78,7 @@ profile_resources() {
|
|||||||
> "$cpu_output_file"
|
> "$cpu_output_file"
|
||||||
> "$timeline_file"
|
> "$timeline_file"
|
||||||
|
|
||||||
# Sample resources every 10ms while process is running
|
# Sample resources every 1ms while process is running
|
||||||
while kill -0 "$pid" 2>/dev/null; do
|
while kill -0 "$pid" 2>/dev/null; do
|
||||||
current_mem=$(get_memory_usage "$pid")
|
current_mem=$(get_memory_usage "$pid")
|
||||||
current_cpu=$(get_cpu_usage "$pid")
|
current_cpu=$(get_cpu_usage "$pid")
|
||||||
@@ -98,7 +98,7 @@ profile_resources() {
|
|||||||
echo "$elapsed_ms $current_mem $current_cpu" >> "$timeline_file"
|
echo "$elapsed_ms $current_mem $current_cpu" >> "$timeline_file"
|
||||||
|
|
||||||
sample_count=$((sample_count + 1))
|
sample_count=$((sample_count + 1))
|
||||||
sleep 0.01 2>/dev/null || sleep 0.1
|
sleep 0.001 2>/dev/null || sleep 0.01
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "$peak_mem $peak_cpu $sample_count"
|
echo "$peak_mem $peak_cpu $sample_count"
|
||||||
|
|||||||
Reference in New Issue
Block a user