This commit was manufactured by cvs2svn to create branch 'vserver'.
[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
32 #define MAX_OPROF_EVENTS    32
33 #define MAX_OPROF_DOMAINS   25  
34 #define XENOPROF_CPU_TYPE_SIZE 64
35
36 /* Xenoprof performance events (not Xen events) */
37 struct event_log {
38     uint64_t eip;
39     uint8_t mode;
40     uint8_t event;
41 };
42
43 /* Xenoprof buffer shared between Xen and domain - 1 per VCPU */
44 struct xenoprof_buf {
45     uint32_t event_head;
46     uint32_t event_tail;
47     uint32_t event_size;
48     uint32_t vcpu_id;
49     uint64_t xen_samples;
50     uint64_t kernel_samples;
51     uint64_t user_samples;
52     uint64_t lost_samples;
53     struct event_log event_log[1];
54 };
55 typedef struct xenoprof_buf xenoprof_buf_t;
56 DEFINE_XEN_GUEST_HANDLE(xenoprof_buf_t);
57
58 struct xenoprof_init {
59     int32_t  max_samples;
60     int32_t  num_events;
61     int32_t  is_primary;
62     int32_t  nbuf;
63     int32_t  bufsize;
64     uint64_t buf_maddr;
65     char cpu_type[XENOPROF_CPU_TYPE_SIZE];
66 };
67 typedef struct xenoprof_init xenoprof_init_t;
68 DEFINE_XEN_GUEST_HANDLE(xenoprof_init_t);
69
70 struct xenoprof_counter {
71     uint32_t ind;
72     uint64_t count;
73     uint32_t enabled;
74     uint32_t event;
75     uint32_t hypervisor;
76     uint32_t kernel;
77     uint32_t user;
78     uint64_t unit_mask;
79 };
80 typedef struct xenoprof_counter xenoprof_counter_t;
81 DEFINE_XEN_GUEST_HANDLE(xenoprof_counter_t);
82
83 typedef struct xenoprof_passive {
84     uint16_t domain_id;
85     int32_t  max_samples;
86     int32_t  nbuf;
87     int32_t  bufsize;
88     uint64_t buf_maddr;
89 } xenoprof_passive_t;
90 DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t);
91
92
93 #endif /* __XEN_PUBLIC_XENOPROF_H__ */
94
95 /*
96  * Local variables:
97  * mode: C
98  * c-set-style: "BSD"
99  * c-basic-offset: 4
100  * tab-width: 4
101  * indent-tabs-mode: nil
102  * End:
103  */