Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / include / xen / interface / xenoprof.h
1 /******************************************************************************
2  * xenoprof.h
3  * 
4  * Interface for enabling system wide profiling based on hardware performance
5  * counters
6  * 
7  * Copyright (C) 2005 Hewlett-Packard Co.
8  * Written by Aravind Menon & Jose Renato Santos
9  */
10
11 #ifndef __XEN_PUBLIC_XENOPROF_H__
12 #define __XEN_PUBLIC_XENOPROF_H__
13
14 /*
15  * Commands to HYPERVISOR_xenoprof_op().
16  */
17 #define XENOPROF_init                0
18 #define XENOPROF_reset_active_list   1
19 #define XENOPROF_reset_passive_list  2
20 #define XENOPROF_set_active          3
21 #define XENOPROF_set_passive         4
22 #define XENOPROF_reserve_counters    5
23 #define XENOPROF_counter             6
24 #define XENOPROF_setup_events        7
25 #define XENOPROF_enable_virq         8
26 #define XENOPROF_start               9
27 #define XENOPROF_stop               10
28 #define XENOPROF_disable_virq       11
29 #define XENOPROF_release_counters   12
30 #define XENOPROF_shutdown           13
31 #define XENOPROF_get_buffer         14
32 #define XENOPROF_last_op            14
33
34 #define MAX_OPROF_EVENTS    32
35 #define MAX_OPROF_DOMAINS   25  
36 #define XENOPROF_CPU_TYPE_SIZE 64
37
38 /* Xenoprof performance events (not Xen events) */
39 struct event_log {
40     uint64_t eip;
41     uint8_t mode;
42     uint8_t event;
43 };
44
45 /* Xenoprof buffer shared between Xen and domain - 1 per VCPU */
46 struct xenoprof_buf {
47     uint32_t event_head;
48     uint32_t event_tail;
49     uint32_t event_size;
50     uint32_t vcpu_id;
51     uint64_t xen_samples;
52     uint64_t kernel_samples;
53     uint64_t user_samples;
54     uint64_t lost_samples;
55     struct event_log event_log[1];
56 };
57 typedef struct xenoprof_buf xenoprof_buf_t;
58 DEFINE_XEN_GUEST_HANDLE(xenoprof_buf_t);
59
60 struct xenoprof_init {
61     int32_t  num_events;
62     int32_t  is_primary;
63     char cpu_type[XENOPROF_CPU_TYPE_SIZE];
64 };
65 typedef struct xenoprof_init xenoprof_init_t;
66 DEFINE_XEN_GUEST_HANDLE(xenoprof_init_t);
67
68 struct xenoprof_get_buffer {
69     int32_t  max_samples;
70     int32_t  nbuf;
71     int32_t  bufsize;
72     uint64_t buf_maddr;
73 };
74 typedef struct xenoprof_get_buffer xenoprof_get_buffer_t;
75 DEFINE_XEN_GUEST_HANDLE(xenoprof_get_buffer_t);
76
77 struct xenoprof_counter {
78     uint32_t ind;
79     uint64_t count;
80     uint32_t enabled;
81     uint32_t event;
82     uint32_t hypervisor;
83     uint32_t kernel;
84     uint32_t user;
85     uint64_t unit_mask;
86 };
87 typedef struct xenoprof_counter xenoprof_counter_t;
88 DEFINE_XEN_GUEST_HANDLE(xenoprof_counter_t);
89
90 typedef struct xenoprof_passive {
91     uint16_t domain_id;
92     int32_t  max_samples;
93     int32_t  nbuf;
94     int32_t  bufsize;
95     uint64_t buf_maddr;
96 } xenoprof_passive_t;
97 DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t);
98
99
100 #endif /* __XEN_PUBLIC_XENOPROF_H__ */
101
102 /*
103  * Local variables:
104  * mode: C
105  * c-set-style: "BSD"
106  * c-basic-offset: 4
107  * tab-width: 4
108  * indent-tabs-mode: nil
109  * End:
110  */