]>
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> | |
24 | ||
25 | #define MAXCPUS 16 | |
26 | #define MAXPIDS 65535 | |
27 | #define MAXSAMPLES 8192 | |
28 | ||
29 | ||
30 | struct block_stat_struct { | |
28989b63 TA |
31 | /* /proc/vmstat pgpgin & pgpgout */ |
32 | int bi; | |
33 | int bo; | |
83fdc450 AK |
34 | }; |
35 | ||
36 | struct cpu_stat_sample_struct { | |
28989b63 TA |
37 | /* /proc/schedstat fields 10 & 11 (after name) */ |
38 | double runtime; | |
39 | double waittime; | |
83fdc450 AK |
40 | }; |
41 | ||
42 | struct cpu_stat_struct { | |
28989b63 TA |
43 | /* per cpu array */ |
44 | struct cpu_stat_sample_struct sample[MAXSAMPLES]; | |
83fdc450 AK |
45 | }; |
46 | ||
47 | /* per process, per sample data we will log */ | |
48 | struct ps_sched_struct { | |
28989b63 TA |
49 | /* /proc/<n>/schedstat fields 1 & 2 */ |
50 | double runtime; | |
51 | double waittime; | |
52 | int pss; | |
83fdc450 AK |
53 | }; |
54 | ||
55 | /* process info */ | |
56 | struct ps_struct { | |
28989b63 TA |
57 | struct ps_struct *next_ps; /* SLL pointer */ |
58 | struct ps_struct *parent; /* ppid ref */ | |
59 | struct ps_struct *children; /* children */ | |
60 | struct ps_struct *next; /* siblings */ | |
83fdc450 | 61 | |
28989b63 TA |
62 | /* must match - otherwise it's a new process with same PID */ |
63 | char name[16]; | |
64 | int pid; | |
65 | int ppid; | |
83fdc450 | 66 | |
28989b63 TA |
67 | /* cache fd's */ |
68 | int sched; | |
69 | int schedstat; | |
70 | FILE *smaps; | |
83fdc450 | 71 | |
28989b63 TA |
72 | /* index to first/last seen timestamps */ |
73 | int first; | |
74 | int last; | |
83fdc450 | 75 | |
28989b63 TA |
76 | /* records actual start time, may be way before bootchart runs */ |
77 | double starttime; | |
83fdc450 | 78 | |
28989b63 TA |
79 | /* record human readable total cpu time */ |
80 | double total; | |
83fdc450 | 81 | |
28989b63 TA |
82 | /* largest PSS size found */ |
83 | int pss_max; | |
83fdc450 | 84 | |
28989b63 TA |
85 | /* for drawing connection lines later */ |
86 | double pos_x; | |
87 | double pos_y; | |
83fdc450 | 88 | |
28989b63 | 89 | struct ps_sched_struct *sample; |
83fdc450 AK |
90 | }; |
91 | ||
92 | extern int entropy_avail[]; | |
93 | ||
94 | extern double graph_start; | |
95 | extern double log_start; | |
96 | extern double sampletime[]; | |
97 | extern struct ps_struct *ps_first; | |
98 | extern struct block_stat_struct blockstat[]; | |
99 | extern struct cpu_stat_struct cpustat[]; | |
100 | extern int pscount; | |
101 | extern int relative; | |
102 | extern int filter; | |
103 | extern int pss; | |
104 | extern int entropy; | |
105 | extern int initcall; | |
106 | extern int samples; | |
107 | extern int cpus; | |
108 | extern int len; | |
109 | extern double hz; | |
110 | extern double scale_x; | |
111 | extern double scale_y; | |
112 | extern int overrun; | |
113 | extern double interval; | |
114 | ||
115 | extern char output_path[PATH_MAX]; | |
116 | extern char init_path[PATH_MAX]; | |
117 | ||
118 | extern FILE *of; | |
119 | extern DIR *proc; | |
b823b5e2 HH |
120 | extern int procfd; |
121 | extern int sysfd; | |
83fdc450 AK |
122 | |
123 | extern double gettime_ns(void); | |
124 | extern void log_uptime(void); | |
125 | extern void log_sample(int sample); | |
126 | ||
e93450c6 | 127 | extern void svg_do(const char *build); |