chiark / gitweb /
service: really stop watchdog timer when stopping
[elogind.git] / src / bootchart / bootchart.h
1 /*
2  * bootchart.h
3  *
4  * Copyright (C) 2009-2012 Intel Coproration
5  *
6  * Authors:
7  *   Auke Kok <auke-jan.h.kok@intel.com>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2
12  * of the License.
13  */
14
15 #include <dirent.h>
16
17 #define MAXCPUS        16
18 #define MAXPIDS     65535
19 #define MAXSAMPLES   8192
20
21
22 struct block_stat_struct {
23         /* /proc/vmstat pgpgin & pgpgout */
24         int bi;
25         int bo;
26 };
27
28 struct cpu_stat_sample_struct {
29         /* /proc/schedstat fields 10 & 11 (after name) */
30         double runtime;
31         double waittime;
32 };
33
34 struct cpu_stat_struct {
35         /* per cpu array */
36         struct cpu_stat_sample_struct sample[MAXSAMPLES];
37 };
38
39 /* per process, per sample data we will log */
40 struct ps_sched_struct {
41         /* /proc/<n>/schedstat fields 1 & 2 */
42         double runtime;
43         double waittime;
44         int pss;
45 };
46
47 /* process info */
48 struct ps_struct {
49         struct ps_struct *next_ps;    /* SLL pointer */
50         struct ps_struct *parent;     /* ppid ref */
51         struct ps_struct *children;   /* children */
52         struct ps_struct *next;       /* siblings */
53
54         /* must match - otherwise it's a new process with same PID */
55         char name[16];
56         int pid;
57         int ppid;
58
59         /* cache fd's */
60         int sched;
61         int schedstat;
62         FILE *smaps;
63
64         /* index to first/last seen timestamps */
65         int first;
66         int last;
67
68         /* records actual start time, may be way before bootchart runs */
69         double starttime;
70
71         /* record human readable total cpu time */
72         double total;
73
74         /* largest PSS size found */
75         int pss_max;
76
77         /* for drawing connection lines later */
78         double pos_x;
79         double pos_y;
80
81         struct ps_sched_struct *sample;
82 };
83
84 extern int entropy_avail[];
85
86 extern double graph_start;
87 extern double log_start;
88 extern double sampletime[];
89 extern struct ps_struct *ps_first;
90 extern struct block_stat_struct blockstat[];
91 extern struct cpu_stat_struct cpustat[];
92 extern int pscount;
93 extern int relative;
94 extern int filter;
95 extern int pss;
96 extern int entropy;
97 extern int initcall;
98 extern int samples;
99 extern int cpus;
100 extern int len;
101 extern double hz;
102 extern double scale_x;
103 extern double scale_y;
104 extern int overrun;
105 extern double interval;
106
107 extern char output_path[PATH_MAX];
108 extern char init_path[PATH_MAX];
109
110 extern FILE *of;
111 extern DIR *proc;
112
113 extern double gettime_ns(void);
114 extern void log_uptime(void);
115 extern void log_sample(int sample);
116
117 extern void svg_do(void);