1 | /****************************************************************************** |
---|
2 | * TOOLS/xenbaked.h |
---|
3 | * |
---|
4 | * Header file for xenbaked |
---|
5 | * |
---|
6 | * Copyright (C) 2005 by Hewlett Packard, Palo Alto and Fort Collins |
---|
7 | * |
---|
8 | * Authors: Diwaker Gupta, diwaker.gupta@hp.com |
---|
9 | * Rob Gardner, rob.gardner@hp.com |
---|
10 | * Lucy Cherkasova, lucy.cherkasova.hp.com |
---|
11 | * |
---|
12 | * This program is free software; you can redistribute it and/or modify |
---|
13 | * it under the terms of the GNU General Public License as published by |
---|
14 | * the Free Software Foundation; under version 2 of the License. |
---|
15 | * |
---|
16 | * This program is distributed in the hope that it will be useful, |
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
19 | * GNU General Public License for more details. |
---|
20 | * |
---|
21 | * You should have received a copy of the GNU General Public License |
---|
22 | * along with this program; if not, write to the Free Software |
---|
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
24 | */ |
---|
25 | |
---|
26 | #ifndef __QOS_H__ |
---|
27 | #define __QOS_H__ |
---|
28 | |
---|
29 | ///// qos stuff |
---|
30 | #define million 1000000LL |
---|
31 | #define billion 1000000000LL |
---|
32 | |
---|
33 | // caution: don't use QOS_ADD with negative numbers! |
---|
34 | #define QOS_ADD(N,A) ((N+A)<(NSAMPLES-1) ? (N+A) : A) |
---|
35 | #define QOS_INCR(N) ((N<(NSAMPLES-2)) ? (N+1) : 0) |
---|
36 | #define QOS_DECR(N) ((N==0) ? (NSAMPLES-1) : (N-1)) |
---|
37 | |
---|
38 | #define MAX_NAME_SIZE 32 |
---|
39 | #define IDLE_DOMAIN_ID 32767 |
---|
40 | |
---|
41 | /* Number of domains we can keep track of in memory */ |
---|
42 | #define NDOMAINS 32 |
---|
43 | |
---|
44 | /* Number of data points to keep */ |
---|
45 | #define NSAMPLES 100 |
---|
46 | |
---|
47 | #define ID(X) ((X>NDOMAINS-1)?(NDOMAINS-1):X) |
---|
48 | #define DEFAULT_TBUF_SIZE 20 |
---|
49 | |
---|
50 | // per domain stuff |
---|
51 | typedef struct |
---|
52 | { |
---|
53 | uint64_t last_update_time; |
---|
54 | uint64_t start_time; // when the thread started running |
---|
55 | uint64_t runnable_start_time; // when the thread became runnable |
---|
56 | uint64_t blocked_start_time; // when the thread became blocked |
---|
57 | uint64_t ns_since_boot; // time gone by since boot |
---|
58 | uint64_t ns_oncpu_since_boot; // total cpu time used by thread since boot |
---|
59 | // uint64_t ns_runnable_since_boot; |
---|
60 | int runnable_at_last_update; // true if the thread was runnable last time we checked. |
---|
61 | int runnable; // true if thread is runnable right now |
---|
62 | // tells us something about what happened during the |
---|
63 | // sample period that we are analysing right now |
---|
64 | int in_use; // |
---|
65 | domid_t id; |
---|
66 | char name[MAX_NAME_SIZE]; |
---|
67 | } _domain_info; |
---|
68 | |
---|
69 | |
---|
70 | |
---|
71 | typedef struct |
---|
72 | { |
---|
73 | struct |
---|
74 | { |
---|
75 | // data point: |
---|
76 | // stuff that is recorded once for each measurement interval |
---|
77 | uint64_t ns_gotten[NDOMAINS]; // ns used in the last sample period |
---|
78 | uint64_t ns_allocated[NDOMAINS]; // ns allocated by scheduler |
---|
79 | uint64_t ns_waiting[NDOMAINS]; // ns spent waiting to execute, ie, time from |
---|
80 | // becoming runnable until actually running |
---|
81 | uint64_t ns_blocked[NDOMAINS]; // ns spent blocked |
---|
82 | uint64_t switchin_count[NDOMAINS]; // number of executions of the domain |
---|
83 | uint64_t io_count[NDOMAINS]; |
---|
84 | uint64_t ns_passed; // ns gone by on the wall clock, ie, the sample period |
---|
85 | uint64_t timestamp; |
---|
86 | uint64_t lost_records; // # of lost trace records this time period |
---|
87 | uint64_t flip_free_periods; // # of executions of dom0 in which no page flips happened |
---|
88 | } qdata[NSAMPLES]; |
---|
89 | |
---|
90 | _domain_info domain_info[NDOMAINS]; |
---|
91 | |
---|
92 | // control information |
---|
93 | int next_datapoint; |
---|
94 | int ncpu; |
---|
95 | int structlen; |
---|
96 | |
---|
97 | // parameters |
---|
98 | int measurement_frequency; // for example |
---|
99 | |
---|
100 | } _new_qos_data; |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | #endif |
---|