1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright (C) 2009-2013 Intel Coproration
11 Auke Kok <auke-jan.h.kok@intel.com>
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.
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.
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/>.
33 #define MAXSAMPLES 8192
35 struct block_stat_struct {
36 /* /proc/vmstat pgpgin & pgpgout */
41 struct cpu_stat_sample_struct {
42 /* /proc/schedstat fields 10 & 11 (after name) */
47 struct cpu_stat_struct {
49 struct cpu_stat_sample_struct sample[MAXSAMPLES];
52 /* per process, per sample data we will log */
53 struct ps_sched_struct {
54 /* /proc/<n>/schedstat fields 1 & 2 */
58 struct list_sample_data *sampledata;
59 struct ps_sched_struct *next;
60 struct ps_sched_struct *prev;
61 struct ps_sched_struct *cross; /* cross pointer */
62 struct ps_struct *ps_new;
65 struct list_sample_data {
66 double runtime[MAXCPUS];
67 double waittime[MAXCPUS];
70 struct block_stat_struct blockstat;
71 struct cpu_stat_struct cpustat;
72 LIST_FIELDS(struct list_sample_data, link); /* DLL */
78 struct ps_struct *next_ps; /* SLL pointer */
79 struct ps_struct *parent; /* ppid ref */
80 struct ps_struct *children; /* children */
81 struct ps_struct *next; /* siblings */
83 /* must match - otherwise it's a new process with same PID */
93 /* pointers to first/last seen timestamps */
94 struct ps_sched_struct *first;
95 struct ps_sched_struct *last;
97 /* records actual start time, may be way before bootchart runs */
100 /* record human readable total cpu time */
103 /* largest PSS size found */
106 /* for drawing connection lines later */
110 struct ps_sched_struct *sample;
113 extern int entropy_avail[];
115 extern double graph_start;
116 extern double log_start;
117 extern double sampletime[];
118 extern struct ps_struct *ps_first;
119 extern struct block_stat_struct blockstat[];
120 extern struct cpu_stat_struct cpustat[];
122 extern bool arg_relative;
123 extern bool arg_filter;
124 extern bool arg_show_cmdline;
126 extern bool arg_entropy;
127 extern bool initcall;
130 extern int arg_samples_len;
131 extern double arg_hz;
132 extern double arg_scale_x;
133 extern double arg_scale_y;
135 extern double interval;
137 extern char arg_output_path[PATH_MAX];
138 extern char arg_init_path[PATH_MAX];