]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/bootchart/bootchart.h
hwdb: Update database of Bluetooth company identifiers
[thirdparty/systemd.git] / src / bootchart / bootchart.h
CommitLineData
6d031c0b
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#pragma once
4
cd3bccaa 5/***
6d031c0b 6 This file is part of systemd.
cd3bccaa 7
3c527fd1 8 Copyright (C) 2009-2013 Intel Corporation
cd3bccaa
AK
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/>.
6d031c0b 25***/
83fdc450 26
f7900e25 27#include <stdbool.h>
8dfb6e71 28#include "list.h"
83fdc450
AK
29
30#define MAXCPUS 16
31#define MAXPIDS 65535
83fdc450 32
83fdc450 33struct block_stat_struct {
28989b63
TA
34 /* /proc/vmstat pgpgin & pgpgout */
35 int bi;
36 int bo;
83fdc450
AK
37};
38
39struct cpu_stat_sample_struct {
28989b63
TA
40 /* /proc/schedstat fields 10 & 11 (after name) */
41 double runtime;
42 double waittime;
83fdc450
AK
43};
44
83fdc450
AK
45/* per process, per sample data we will log */
46struct ps_sched_struct {
28989b63
TA
47 /* /proc/<n>/schedstat fields 1 & 2 */
48 double runtime;
49 double waittime;
50 int pss;
8dfb6e71
NC
51 struct list_sample_data *sampledata;
52 struct ps_sched_struct *next;
53 struct ps_sched_struct *prev;
54 struct ps_sched_struct *cross; /* cross pointer */
55 struct ps_struct *ps_new;
56};
57
58struct list_sample_data {
59 double runtime[MAXCPUS];
60 double waittime[MAXCPUS];
61 double sampletime;
62 int entropy_avail;
63 struct block_stat_struct blockstat;
8dfb6e71
NC
64 LIST_FIELDS(struct list_sample_data, link); /* DLL */
65 int counter;
83fdc450
AK
66};
67
68/* process info */
69struct ps_struct {
28989b63
TA
70 struct ps_struct *next_ps; /* SLL pointer */
71 struct ps_struct *parent; /* ppid ref */
72 struct ps_struct *children; /* children */
73 struct ps_struct *next; /* siblings */
83fdc450 74
28989b63 75 /* must match - otherwise it's a new process with same PID */
e90f9fa4 76 char name[256];
28989b63
TA
77 int pid;
78 int ppid;
49e5b2a9 79 char *cgroup;
83fdc450 80
28989b63
TA
81 /* cache fd's */
82 int sched;
83 int schedstat;
84 FILE *smaps;
83fdc450 85
8dfb6e71
NC
86 /* pointers to first/last seen timestamps */
87 struct ps_sched_struct *first;
88 struct ps_sched_struct *last;
83fdc450 89
28989b63
TA
90 /* records actual start time, may be way before bootchart runs */
91 double starttime;
83fdc450 92
28989b63
TA
93 /* record human readable total cpu time */
94 double total;
83fdc450 95
28989b63
TA
96 /* largest PSS size found */
97 int pss_max;
83fdc450 98
28989b63
TA
99 /* for drawing connection lines later */
100 double pos_x;
101 double pos_y;
83fdc450 102
28989b63 103 struct ps_sched_struct *sample;
83fdc450
AK
104};
105
6d031c0b
LP
106extern bool arg_relative;
107extern bool arg_filter;
108extern bool arg_show_cmdline;
49e5b2a9 109extern bool arg_show_cgroup;
6d031c0b
LP
110extern bool arg_pss;
111extern bool arg_entropy;
749806b3 112extern bool arg_percpu;
1f2ecb03
DM
113extern bool arg_initcall;
114extern int arg_samples_len;
6d031c0b
LP
115extern double arg_hz;
116extern double arg_scale_x;
117extern double arg_scale_y;
83fdc450 118
6d031c0b
LP
119extern char arg_output_path[PATH_MAX];
120extern char arg_init_path[PATH_MAX];