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:
Ein Anderssono
2026-04-23 01:41:07 +02:00
parent a0394572cf
commit f81fbb8d25
+2 -2
View File
@@ -78,7 +78,7 @@ profile_resources() {
> "$cpu_output_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
current_mem=$(get_memory_usage "$pid")
current_cpu=$(get_cpu_usage "$pid")
@@ -98,7 +98,7 @@ profile_resources() {
echo "$elapsed_ms $current_mem $current_cpu" >> "$timeline_file"
sample_count=$((sample_count + 1))
sleep 0.01 2>/dev/null || sleep 0.1
sleep 0.001 2>/dev/null || sleep 0.01
done
echo "$peak_mem $peak_cpu $sample_count"