]>
Commit | Line | Data |
---|---|---|
cd3bccaa AK |
1 | /*** |
2 | bootchart.h - This file is part of systemd-bootchart | |
3 | ||
4 | Copyright (C) 2009-2013 Intel Coproration | |
5 | ||
6 | Authors: | |
7 | Auke Kok <auke-jan.h.kok@intel.com> | |
8 | ||
9 | systemd is free software; you can redistribute it and/or modify it | |
10 | under the terms of the GNU Lesser General Public License as published by | |
11 | the Free Software Foundation; either version 2.1 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | systemd is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | Lesser General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU Lesser General Public License | |
20 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
21 | ***/ | |
83fdc450 AK |
22 | |
23 | #include <dirent.h> | |
f7900e25 | 24 | #include <stdbool.h> |
83fdc450 AK |
25 | |
26 | #define MAXCPUS 16 | |
27 | #define MAXPIDS 65535 | |
28 | #define MAXSAMPLES 8192 | |
29 | ||
30 | ||
31 | struct block_stat_struct { | |
28989b63 TA |
32 | /* /proc/vmstat pgpgin & pgpgout */ |
33 | int bi; | |
34 | int bo; | |
83fdc450 AK |
35 | }; |
36 | ||
37 | struct cpu_stat_sample_struct { | |
28989b63 TA |
38 | /* /proc/schedstat fields 10 & 11 (after name) */ |
39 | double runtime; | |
40 | double waittime; | |
83fdc450 AK |
41 | }; |
42 | ||
43 | struct cpu_stat_struct { | |
28989b63 TA |
44 | /* per cpu array */ |
45 | struct cpu_stat_sample_struct sample[MAXSAMPLES]; | |
83fdc450 AK |
46 | }; |
47 | ||
48 | /* per process, per sample data we will log */ | |
49 | struct ps_sched_struct { | |
28989b63 TA |
50 | /* /proc/<n>/schedstat fields 1 & 2 */ |
51 | double runtime; | |
52 | double waittime; | |
53 | int pss; | |
83fdc450 AK |
54 | }; |
55 | ||
56 | /* process info */ | |
57 | struct ps_struct { | |
28989b63 TA |
58 | struct ps_struct *next_ps; /* SLL pointer */ |
59 | struct ps_struct *parent; /* ppid ref */ | |
60 | struct ps_struct *children; /* children */ | |
61 | struct ps_struct *next; /* siblings */ | |
83fdc450 | 62 | |
28989b63 | 63 | /* must match - otherwise it's a new process with same PID */ |
e90f9fa4 | 64 | char name[256]; |
28989b63 TA |
65 | int pid; |
66 | int ppid; | |
83fdc450 | 67 | |
28989b63 TA |
68 | /* cache fd's */ |
69 | int sched; | |
70 | int schedstat; | |
71 | FILE *smaps; | |
83fdc450 | 72 | |
28989b63 TA |
73 | /* index to first/last seen timestamps */ |
74 | int first; | |
75 | int last; | |
83fdc450 | 76 | |
28989b63 TA |
77 | /* records actual start time, may be way before bootchart runs */ |
78 | double starttime; | |
83fdc450 | 79 | |
28989b63 TA |
80 | /* record human readable total cpu time */ |
81 | double total; | |
83fdc450 | 82 | |
28989b63 TA |
83 | /* largest PSS size found */ |
84 | int pss_max; | |
83fdc450 | 85 | |
28989b63 TA |
86 | /* for drawing connection lines later */ |
87 | double pos_x; | |
88 | double pos_y; | |
83fdc450 | 89 | |
28989b63 | 90 | struct ps_sched_struct *sample; |
83fdc450 AK |
91 | }; |
92 | ||
93 | extern int entropy_avail[]; | |
94 | ||
95 | extern double graph_start; | |
96 | extern double log_start; | |
97 | extern double sampletime[]; | |
98 | extern struct ps_struct *ps_first; | |
99 | extern struct block_stat_struct blockstat[]; | |
100 | extern struct cpu_stat_struct cpustat[]; | |
101 | extern int pscount; | |
f7900e25 TA |
102 | extern bool relative; |
103 | extern bool filter; | |
e90f9fa4 | 104 | extern bool show_cmdline; |
f7900e25 TA |
105 | extern bool pss; |
106 | extern bool entropy; | |
107 | extern bool initcall; | |
83fdc450 AK |
108 | extern int samples; |
109 | extern int cpus; | |
b9a496c1 | 110 | extern int samples_len; |
83fdc450 AK |
111 | extern double hz; |
112 | extern double scale_x; | |
113 | extern double scale_y; | |
114 | extern int overrun; | |
115 | extern double interval; | |
116 | ||
117 | extern char output_path[PATH_MAX]; | |
118 | extern char init_path[PATH_MAX]; | |
119 | ||
120 | extern FILE *of; | |
121 | extern DIR *proc; | |
b823b5e2 HH |
122 | extern int procfd; |
123 | extern int sysfd; | |
83fdc450 AK |
124 | |
125 | extern double gettime_ns(void); | |
126 | extern void log_uptime(void); | |
127 | extern void log_sample(int sample); | |
128 | ||
e93450c6 | 129 | extern void svg_do(const char *build); |