]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/bootchart/bootchart.h
core: do not overwrite existing units source
[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>
24
25#define MAXCPUS 16
26#define MAXPIDS 65535
27#define MAXSAMPLES 8192
28
29
30struct block_stat_struct {
28989b63
TA
31 /* /proc/vmstat pgpgin & pgpgout */
32 int bi;
33 int bo;
83fdc450
AK
34};
35
36struct cpu_stat_sample_struct {
28989b63
TA
37 /* /proc/schedstat fields 10 & 11 (after name) */
38 double runtime;
39 double waittime;
83fdc450
AK
40};
41
42struct 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 */
48struct 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 */
56struct 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
92extern int entropy_avail[];
93
94extern double graph_start;
95extern double log_start;
96extern double sampletime[];
97extern struct ps_struct *ps_first;
98extern struct block_stat_struct blockstat[];
99extern struct cpu_stat_struct cpustat[];
100extern int pscount;
101extern int relative;
102extern int filter;
103extern int pss;
104extern int entropy;
105extern int initcall;
106extern int samples;
107extern int cpus;
108extern int len;
109extern double hz;
110extern double scale_x;
111extern double scale_y;
112extern int overrun;
113extern double interval;
114
115extern char output_path[PATH_MAX];
116extern char init_path[PATH_MAX];
117
118extern FILE *of;
119extern DIR *proc;
b823b5e2
HH
120extern int procfd;
121extern int sysfd;
83fdc450
AK
122
123extern double gettime_ns(void);
124extern void log_uptime(void);
125extern void log_sample(int sample);
126
e93450c6 127extern void svg_do(const char *build);