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