Added child CPU time to account for short lived processes
This commit is contained in:
parent
54f22771dc
commit
afc17db869
@ -57,11 +57,19 @@ int parseStatFile(Process *proc, char *filedata) {
|
|||||||
|
|
||||||
// (15) stime - %lu
|
// (15) stime - %lu
|
||||||
proc->cpuTime += fast_str2ull(&location);
|
proc->cpuTime += fast_str2ull(&location);
|
||||||
|
location += 1;
|
||||||
|
|
||||||
|
// (16) cutime - %lu
|
||||||
|
proc->cpuTime += fast_str2ull(&location);
|
||||||
|
location += 1;
|
||||||
|
|
||||||
|
// (17) cstime - %lu
|
||||||
|
proc->cpuTime += fast_str2ull(&location);
|
||||||
proc->cCpuTime = proc->cpuTime;
|
proc->cCpuTime = proc->cpuTime;
|
||||||
location += 1;
|
location += 1;
|
||||||
|
|
||||||
// skip 16-19
|
// skip 18-19
|
||||||
skipRange(16, 20);
|
skipRange(18, 20);
|
||||||
|
|
||||||
// (20) num_threads - %ld
|
// (20) num_threads - %ld
|
||||||
proc->nThreads = fast_str2ull(&location);
|
proc->nThreads = fast_str2ull(&location);
|
||||||
@ -354,6 +362,7 @@ nextProcess:
|
|||||||
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
|
// stats used to make flame chart
|
||||||
ptr += sprintf(ptr, "process_tree_depth{%s} %d\n", buffer, cur->level);
|
ptr += sprintf(ptr, "process_tree_depth{%s} %d\n", buffer, cur->level);
|
||||||
ptr += sprintf(ptr, "process_visit_index{%s} %d\n", buffer, cur->visited);
|
ptr += sprintf(ptr, "process_visit_index{%s} %d\n", buffer, cur->visited);
|
||||||
|
|||||||
@ -86,6 +86,7 @@ void handle_client(int client_socket) {
|
|||||||
closeConnection:
|
closeConnection:
|
||||||
printf("Closing connection\n");
|
printf("Closing connection\n");
|
||||||
// Close the client socket
|
// Close the client socket
|
||||||
|
usleep(100000);
|
||||||
close(client_socket);
|
close(client_socket);
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user