ia64/xen-unstable

view xen/include/xen/perfc.h @ 19848:5839491bbf20

[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.

don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 11:26:05 2009 +0900 (2009-06-29)
parents ea0b50ca4999
children
line source
1 #ifndef __XEN_PERFC_H__
2 #define __XEN_PERFC_H__
4 #ifdef PERF_COUNTERS
6 #include <xen/lib.h>
7 #include <xen/smp.h>
8 #include <xen/percpu.h>
10 /*
11 * NOTE: new counters must be defined in perfc_defn.h
12 *
13 * Counter declarations:
14 * PERFCOUNTER (counter, string) define a new performance counter
15 * PERFCOUNTER_ARRAY (counter, string, size) define an array of counters
16 *
17 * Unlike counters, status variables do not reset:
18 * PERFSTATUS (counter, string) define a new performance stauts
19 * PERFSTATUS_ARRAY (counter, string, size) define an array of status vars
20 *
21 * unsigned long perfc_value (counter) get value of a counter
22 * unsigned long perfc_valuea (counter, index) get value of an array counter
23 * unsigned long perfc_set (counter, val) set value of a counter
24 * unsigned long perfc_seta (counter, index, val) set value of an array counter
25 * void perfc_incr (counter) increment a counter
26 * void perfc_decr (counter) decrement a status
27 * void perfc_incra (counter, index) increment an array counter
28 * void perfc_add (counter, value) add a value to a counter
29 * void perfc_adda (counter, index, value) add a value to array counter
30 * void perfc_print (counter) print out the counter
31 */
33 #define PERFCOUNTER( name, descr ) \
34 PERFC_##name,
35 #define PERFCOUNTER_ARRAY( name, descr, size ) \
36 PERFC_##name, \
37 PERFC_LAST_##name = PERFC_ ## name + (size) - sizeof(char[2 * !!(size) - 1]),
39 #define PERFSTATUS PERFCOUNTER
40 #define PERFSTATUS_ARRAY PERFCOUNTER_ARRAY
42 enum perfcounter {
43 #include <xen/perfc_defn.h>
44 NUM_PERFCOUNTERS
45 };
47 #undef PERFCOUNTER
48 #undef PERFCOUNTER_ARRAY
49 #undef PERFSTATUS
50 #undef PERFSTATUS_ARRAY
52 typedef unsigned perfc_t;
53 #define PRIperfc ""
55 DECLARE_PER_CPU(perfc_t[NUM_PERFCOUNTERS], perfcounters);
57 #define perfc_value(x) this_cpu(perfcounters)[PERFC_ ## x]
58 #define perfc_valuea(x,y) \
59 ( (y) <= PERFC_LAST_ ## x - PERFC_ ## x ? \
60 this_cpu(perfcounters)[PERFC_ ## x + (y)] : 0 )
61 #define perfc_set(x,v) (this_cpu(perfcounters)[PERFC_ ## x] = (v))
62 #define perfc_seta(x,y,v) \
63 ( (y) <= PERFC_LAST_ ## x - PERFC_ ## x ? \
64 this_cpu(perfcounters)[PERFC_ ## x + (y)] = (v) : (v) )
65 #define perfc_incr(x) (++this_cpu(perfcounters)[PERFC_ ## x])
66 #define perfc_decr(x) (--this_cpu(perfcounters)[PERFC_ ## x])
67 #define perfc_incra(x,y) \
68 ( (y) <= PERFC_LAST_ ## x - PERFC_ ## x ? \
69 ++this_cpu(perfcounters)[PERFC_ ## x + (y)] : 0 )
70 #define perfc_add(x,v) (this_cpu(perfcounters)[PERFC_ ## x] += (v))
71 #define perfc_adda(x,y,v) \
72 ( (y) <= PERFC_LAST_ ## x - PERFC_ ## x ? \
73 this_cpu(perfcounters)[PERFC_ ## x + (y)] = (v) : (v) )
75 /*
76 * Histogram: special treatment for 0 and 1 count. After that equally spaced
77 * with last bucket taking the rest.
78 */
79 #ifdef PERF_ARRAYS
80 #define perfc_incr_histo(x,v) \
81 do { \
82 if ( (v) == 0 ) \
83 perfc_incra(x, 0); \
84 else if ( (v) == 1 ) \
85 perfc_incra(x, 1); \
86 else if ( (((v) - 2) / PERFC_ ## x ## _BUCKET_SIZE) < \
87 (PERFC_LAST_ ## x - PERFC_ ## x - 2) ) \
88 perfc_incra(x, (((v) - 2) / PERFC_ ## x ## _BUCKET_SIZE) + 2); \
89 else \
90 perfc_incra(x, PERFC_LAST_ ## x - PERFC_ ## x); \
91 } while ( 0 )
92 #else
93 #define perfc_incr_histo(x,v) ((void)0)
94 #endif
96 struct xen_sysctl_perfc_op;
97 int perfc_control(struct xen_sysctl_perfc_op *);
99 #else /* PERF_COUNTERS */
101 #define perfc_value(x) (0)
102 #define perfc_valuea(x,y) (0)
103 #define perfc_set(x,v) ((void)0)
104 #define perfc_seta(x,y,v) ((void)0)
105 #define perfc_incr(x) ((void)0)
106 #define perfc_decr(x) ((void)0)
107 #define perfc_incra(x,y) ((void)0)
108 #define perfc_decra(x,y) ((void)0)
109 #define perfc_add(x,y) ((void)0)
110 #define perfc_adda(x,y,z) ((void)0)
111 #define perfc_incr_histo(x,y,z) ((void)0)
113 #endif /* PERF_COUNTERS */
115 #endif /* __XEN_PERFC_H__ */