]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/bootchart/bootchart.h
bootchart: rename global len to samples_len
[thirdparty/systemd.git] / src / bootchart / bootchart.h
CommitLineData
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
31struct block_stat_struct {
28989b63
TA
32 /* /proc/vmstat pgpgin & pgpgout */
33 int bi;
34 int bo;
83fdc450
AK
35};
36
37struct cpu_stat_sample_struct {
28989b63
TA
38 /* /proc/schedstat fields 10 & 11 (after name) */
39 double runtime;
40 double waittime;
83fdc450
AK
41};
42
43struct 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 */
49struct 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 */
57struct 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
93extern int entropy_avail[];
94
95extern double graph_start;
96extern double log_start;
97extern double sampletime[];
98extern struct ps_struct *ps_first;
99extern struct block_stat_struct blockstat[];
100extern struct cpu_stat_struct cpustat[];
101extern int pscount;
f7900e25
TA
102extern bool relative;
103extern bool filter;
e90f9fa4 104extern bool show_cmdline;
f7900e25
TA
105extern bool pss;
106extern bool entropy;
107extern bool initcall;
83fdc450
AK
108extern int samples;
109extern int cpus;
b9a496c1 110extern int samples_len;
83fdc450
AK
111extern double hz;
112extern double scale_x;
113extern double scale_y;
114extern int overrun;
115extern double interval;
116
117extern char output_path[PATH_MAX];
118extern char init_path[PATH_MAX];
119
120extern FILE *of;
121extern DIR *proc;
b823b5e2
HH
122extern int procfd;
123extern int sysfd;
83fdc450
AK
124
125extern double gettime_ns(void);
126extern void log_uptime(void);
127extern void log_sample(int sample);
128
e93450c6 129extern void svg_do(const char *build);