[9871f0]: daemon / liblegacy / opd_24_stats.c Maximize Restore History

Download this file

opd_24_stats.c    61 lines (55 with data), 2.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* @file opd_24_stats.c
* Management of daemon statistics
*
* @remark Copyright 2002 OProfile authors
* @remark Read the file COPYING
*
* @author John Levon
* @author Philippe Elie
*/
#include "opd_24_stats.h"
#include "opd_proc.h"
#include "opd_image.h"
#include "oprofiled.h"
#include "op_get_time.h"
#include <stdlib.h>
#include <stdio.h>
unsigned long opd_24_stats[OPD_MAX_STATS];
void opd_print_24_stats(void)
{
printf("\n%s\n", op_get_time());
printf("Nr. proc struct: %d\n", opd_get_nr_procs());
printf("Nr. image struct: %d\n", opd_get_nr_images());
printf("Nr. kernel samples: %lu\n", opd_24_stats[OPD_KERNEL]);
printf("Nr. modules samples: %lu\n", opd_24_stats[OPD_MODULE]);
printf("Nr. modules samples lost: %lu\n", opd_24_stats[OPD_LOST_MODULE]);
printf("Nr. samples lost due to no process information: %lu\n",
opd_24_stats[OPD_LOST_PROCESS]);
printf("Nr. process samples in user-space: %lu\n", opd_24_stats[OPD_PROCESS]);
printf("Nr. samples lost due to no map information: %lu\n",
opd_24_stats[OPD_LOST_MAP_PROCESS]);
if (opd_24_stats[OPD_PROC_QUEUE_ACCESS]) {
printf("Average depth of search of proc queue: %f\n",
(double)opd_24_stats[OPD_PROC_QUEUE_DEPTH]
/ (double)opd_24_stats[OPD_PROC_QUEUE_ACCESS]);
}
if (opd_24_stats[OPD_MAP_ARRAY_ACCESS]) {
printf("Average depth of iteration through mapping array: %f\n",
(double)opd_24_stats[OPD_MAP_ARRAY_DEPTH]
/ (double)opd_24_stats[OPD_MAP_ARRAY_ACCESS]);
}
if (opd_24_stats[OPD_IMAGE_HASH_ACCESS]) {
printf("Average depth of iteration through image hash array: %f\n",
(double)opd_24_stats[OPD_IMAGE_HASH_DEPTH]
/ (double)opd_24_stats[OPD_IMAGE_HASH_ACCESS]);
}
printf("Nr. sample dumps: %lu\n", opd_24_stats[OPD_DUMP_COUNT]);
printf("Nr. samples total: %lu\n", opd_24_stats[OPD_SAMPLES]);
printf("Nr. notifications: %lu\n", opd_24_stats[OPD_NOTIFICATIONS]);
printf("Nr. kernel note buffer overflow: %u\n",
opd_read_fs_int(OP_MOUNT, "note_buffer_overflow"));
printf("Nr. kernel samples buffer overflow: %u\n",
opd_read_fs_int(OP_MOUNT, "buffer_overflow"));
fflush(stdout);
}