Include visit order in stats
This commit is contained in:
parent
187bf253e3
commit
4e9da25009
10
src/server.c
10
src/server.c
@ -190,9 +190,9 @@ void aggregateStats(Process *head) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
current->visited = 1;
|
|
||||||
current->level = depth;
|
|
||||||
visited++;
|
visited++;
|
||||||
|
current->visited = visited; // store to tag the order the process is visited
|
||||||
|
current->level = depth;
|
||||||
|
|
||||||
if (depth > maxdepth) maxdepth = depth;
|
if (depth > maxdepth) maxdepth = depth;
|
||||||
|
|
||||||
@ -329,6 +329,7 @@ char *readProcesses(char *procdir) {
|
|||||||
sprintf(buffer,
|
sprintf(buffer,
|
||||||
"pid=\"%d\",ppid=\"%d\",label=\"%s\",lxc=\"%d\"",
|
"pid=\"%d\",ppid=\"%d\",label=\"%s\",lxc=\"%d\"",
|
||||||
cur->pid, cur->ppid, cur->label, cur->lxc);
|
cur->pid, cur->ppid, cur->label, cur->lxc);
|
||||||
|
// process specific stats
|
||||||
ptr += sprintf(ptr, "process_cpu_time_seconds{%s} %f\n", buffer, (double) cur->cpuTime / clocks);
|
ptr += sprintf(ptr, "process_cpu_time_seconds{%s} %f\n", buffer, (double) cur->cpuTime / clocks);
|
||||||
ptr += sprintf(ptr, "process_num_threads{%s} %lu\n", buffer, cur->nThreads);
|
ptr += sprintf(ptr, "process_num_threads{%s} %lu\n", buffer, cur->nThreads);
|
||||||
ptr += sprintf(ptr, "process_resident_bytes{%s} %lu\n", buffer, cur->resident);
|
ptr += sprintf(ptr, "process_resident_bytes{%s} %lu\n", buffer, cur->resident);
|
||||||
@ -336,12 +337,15 @@ char *readProcesses(char *procdir) {
|
|||||||
ptr += sprintf(ptr, "process_fileio_bytes_written{%s} %lu\n", buffer, cur->written);
|
ptr += sprintf(ptr, "process_fileio_bytes_written{%s} %lu\n", buffer, cur->written);
|
||||||
ptr += sprintf(ptr, "process_fileio_bytes_read{%s} %lu\n", buffer, cur->read);
|
ptr += sprintf(ptr, "process_fileio_bytes_read{%s} %lu\n", buffer, cur->read);
|
||||||
ptr += sprintf(ptr, "process_is_kernel_process{%s} %d\n", buffer, cur->iskernel);
|
ptr += sprintf(ptr, "process_is_kernel_process{%s} %d\n", buffer, cur->iskernel);
|
||||||
ptr += sprintf(ptr, "process_tree_depth{%s} %d\n", buffer, cur->level);
|
// cumulative fields
|
||||||
ptr += sprintf(ptr, "process_cumulative_cpu_time_seconds{%s} %lu\n", buffer, cur->cCpuTime);
|
ptr += sprintf(ptr, "process_cumulative_cpu_time_seconds{%s} %lu\n", buffer, cur->cCpuTime);
|
||||||
ptr += sprintf(ptr, "process_cumulative_resident_bytes{%s} %lu\n", buffer, cur->cMemory);
|
ptr += sprintf(ptr, "process_cumulative_resident_bytes{%s} %lu\n", buffer, cur->cMemory);
|
||||||
ptr += sprintf(ptr, "process_cumulative_swap_bytes{%s} %lu\n", buffer, cur->cSwap);
|
ptr += sprintf(ptr, "process_cumulative_swap_bytes{%s} %lu\n", buffer, cur->cSwap);
|
||||||
ptr += sprintf(ptr, "process_cumulative_bytes_read{%s} %lu\n", buffer, cur->cRead);
|
ptr += sprintf(ptr, "process_cumulative_bytes_read{%s} %lu\n", buffer, cur->cRead);
|
||||||
ptr += sprintf(ptr, "process_cumulative_bytes_written{%s} %lu\n", buffer, cur->cWrite);
|
ptr += sprintf(ptr, "process_cumulative_bytes_written{%s} %lu\n", buffer, cur->cWrite);
|
||||||
|
// stats used to make flame chart
|
||||||
|
ptr += sprintf(ptr, "process_tree_depth{%s} %d\n", buffer, cur->level);
|
||||||
|
ptr += sprintf(ptr, "process_visit_index{%s} %d\n", buffer, cur->visited);
|
||||||
// free and proceed
|
// free and proceed
|
||||||
Process *prev = cur;
|
Process *prev = cur;
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user