Commit 8d09647b authored by Jesse McKenna's avatar Jesse McKenna Committed by Commit Bot

IdleWakeups: exclude idle snapshots from summary

This change makes IdleWakeups aggregate only measurements taken while
the target process was running. Zero values taken while the process
was not running (output rows showing "0 processes") are excluded from
the final average and median.

This prevents 0 values during idle time from skewing down the final
results.

Change-Id: I10a301cf7e20da5b51db6e986f18c9b37d73d05b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2380198Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Commit-Queue: Jesse McKenna <jessemckenna@google.com>
Cr-Commit-Position: refs/heads/master@{#802781}
parent 212025d2
......@@ -300,6 +300,7 @@ int wmain(int argc, wchar_t* argv[]) {
ULONGLONG cumulative_working_set = 0;
double cumulative_energy = 0.0;
size_t cumulative_processes_created = 0;
int num_idle_snapshots = 0;
ResultVector results;
......@@ -331,12 +332,15 @@ int wmain(int argc, wchar_t* argv[]) {
result.idle_wakeups_per_sec, result.cpu_usage, '%',
result.working_set / 1024.0, result.power);
cumulative_idle_wakeups_per_sec += result.idle_wakeups_per_sec;
cumulative_cpu_usage += result.cpu_usage;
cumulative_working_set += result.working_set;
cumulative_energy += result.power;
results.push_back(result);
if (number_of_processes > 0) {
cumulative_idle_wakeups_per_sec += result.idle_wakeups_per_sec;
cumulative_cpu_usage += result.cpu_usage;
cumulative_working_set += result.working_set;
cumulative_energy += result.power;
results.push_back(result);
} else {
num_idle_snapshots++;
}
}
CloseHandle(ctrl_c_pressed);
......@@ -365,7 +369,10 @@ int wmain(int argc, wchar_t* argv[]) {
median_result.idle_wakeups_per_sec, median_result.cpu_usage, '%',
median_result.working_set / 1024.0, median_result.power);
printf("\nProcesses created: %zu\n", cumulative_processes_created);
printf("\n");
if (num_idle_snapshots > 0)
printf("Idle snapshots: %d\n", num_idle_snapshots);
printf("Processes created: %zu\n", cumulative_processes_created);
printf("Processes destroyed: %zu\n", initial_number_of_processes +
cumulative_processes_created -
final_number_of_processes);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment