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, see <http://www.gnu.org/licenses/>. 23 */ 24 25 #ifndef __QOS_H__ 26 #define __QOS_H__ 27 28 ///// qos stuff 29 #define million 1000000LL 30 #define billion 1000000000LL 31 32 // caution: don't use QOS_ADD with negative numbers! 33 #define QOS_ADD(N,A) ((N+A)<(NSAMPLES-1) ? (N+A) : A) 34 #define QOS_INCR(N) ((N<(NSAMPLES-2)) ? (N+1) : 0) 35 #define QOS_DECR(N) ((N==0) ? (NSAMPLES-1) : (N-1)) 36 37 #define MAX_NAME_SIZE 32 38 #define IDLE_DOMAIN_ID 32767 39 40 /* Number of domains we can keep track of in memory */ 41 #define NDOMAINS 32 42 43 /* Number of data points to keep */ 44 #define NSAMPLES 100 45 46 #define ID(X) ((X>NDOMAINS-1)?(NDOMAINS-1):X) 47 #define DEFAULT_TBUF_SIZE 20 48 49 // per domain stuff 50 typedef struct 51 { 52 uint64_t last_update_time; 53 uint64_t start_time; // when the thread started running 54 uint64_t runnable_start_time; // when the thread became runnable 55 uint64_t blocked_start_time; // when the thread became blocked 56 uint64_t ns_since_boot; // time gone by since boot 57 uint64_t ns_oncpu_since_boot; // total cpu time used by thread since boot 58 // uint64_t ns_runnable_since_boot; 59 int runnable_at_last_update; // true if the thread was runnable last time we checked. 60 int runnable; // true if thread is runnable right now 61 // tells us something about what happened during the 62 // sample period that we are analysing right now 63 int in_use; // 64 domid_t id; 65 char name[MAX_NAME_SIZE]; 66 } _domain_info; 67 68 69 70 typedef struct 71 { 72 struct 73 { 74 // data point: 75 // stuff that is recorded once for each measurement interval 76 uint64_t ns_gotten[NDOMAINS]; // ns used in the last sample period 77 uint64_t ns_allocated[NDOMAINS]; // ns allocated by scheduler 78 uint64_t ns_waiting[NDOMAINS]; // ns spent waiting to execute, ie, time from 79 // becoming runnable until actually running 80 uint64_t ns_blocked[NDOMAINS]; // ns spent blocked 81 uint64_t switchin_count[NDOMAINS]; // number of executions of the domain 82 uint64_t io_count[NDOMAINS]; 83 uint64_t ns_passed; // ns gone by on the wall clock, ie, the sample period 84 uint64_t timestamp; 85 uint64_t lost_records; // # of lost trace records this time period 86 uint64_t flip_free_periods; // # of executions of dom0 in which no page flips happened 87 } qdata[NSAMPLES]; 88 89 _domain_info domain_info[NDOMAINS]; 90 91 // control information 92 int next_datapoint; 93 int ncpu; 94 int structlen; 95 96 // parameters 97 int measurement_frequency; // for example 98 99 } _new_qos_data; 100 101 102 103 #endif 104