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