Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / xen / include / xen3-public / xenoprof.h
blobcbd56140a8c7803eeb98f791fef19f99060f2614
1 /* $NetBSD: xenoprof.h,v 1.2 2007/09/23 16:25:29 bouyer Exp $ */
2 /******************************************************************************
3 * xenoprof.h
4 *
5 * Interface for enabling system wide profiling based on hardware performance
6 * counters
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to
10 * deal in the Software without restriction, including without limitation the
11 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 * sell copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
26 * Copyright (C) 2005 Hewlett-Packard Co.
27 * Written by Aravind Menon & Jose Renato Santos
30 #ifndef __XEN_PUBLIC_XENOPROF_H__
31 #define __XEN_PUBLIC_XENOPROF_H__
33 #include "xen.h"
36 * Commands to HYPERVISOR_xenoprof_op().
38 #define XENOPROF_init 0
39 #define XENOPROF_reset_active_list 1
40 #define XENOPROF_reset_passive_list 2
41 #define XENOPROF_set_active 3
42 #define XENOPROF_set_passive 4
43 #define XENOPROF_reserve_counters 5
44 #define XENOPROF_counter 6
45 #define XENOPROF_setup_events 7
46 #define XENOPROF_enable_virq 8
47 #define XENOPROF_start 9
48 #define XENOPROF_stop 10
49 #define XENOPROF_disable_virq 11
50 #define XENOPROF_release_counters 12
51 #define XENOPROF_shutdown 13
52 #define XENOPROF_get_buffer 14
53 #define XENOPROF_set_backtrace 15
54 #define XENOPROF_last_op 15
56 #define MAX_OPROF_EVENTS 32
57 #define MAX_OPROF_DOMAINS 25
58 #define XENOPROF_CPU_TYPE_SIZE 64
60 /* Xenoprof performance events (not Xen events) */
61 struct event_log {
62 uint64_t eip;
63 uint8_t mode;
64 uint8_t event;
67 /* PC value that indicates a special code */
68 #define XENOPROF_ESCAPE_CODE ~0UL
69 /* Transient events for the xenoprof->oprofile cpu buf */
70 #define XENOPROF_TRACE_BEGIN 1
72 /* Xenoprof buffer shared between Xen and domain - 1 per VCPU */
73 struct xenoprof_buf {
74 uint32_t event_head;
75 uint32_t event_tail;
76 uint32_t event_size;
77 uint32_t vcpu_id;
78 uint64_t xen_samples;
79 uint64_t kernel_samples;
80 uint64_t user_samples;
81 uint64_t lost_samples;
82 struct event_log event_log[1];
84 #ifndef __XEN__
85 typedef struct xenoprof_buf xenoprof_buf_t;
86 DEFINE_XEN_GUEST_HANDLE(xenoprof_buf_t);
87 #endif
89 struct xenoprof_init {
90 int32_t num_events;
91 int32_t is_primary;
92 char cpu_type[XENOPROF_CPU_TYPE_SIZE];
94 typedef struct xenoprof_init xenoprof_init_t;
95 DEFINE_XEN_GUEST_HANDLE(xenoprof_init_t);
97 struct xenoprof_get_buffer {
98 int32_t max_samples;
99 int32_t nbuf;
100 int32_t bufsize;
101 uint64_t buf_gmaddr;
103 typedef struct xenoprof_get_buffer xenoprof_get_buffer_t;
104 DEFINE_XEN_GUEST_HANDLE(xenoprof_get_buffer_t);
106 struct xenoprof_counter {
107 uint32_t ind;
108 uint64_t count;
109 uint32_t enabled;
110 uint32_t event;
111 uint32_t hypervisor;
112 uint32_t kernel;
113 uint32_t user;
114 uint64_t unit_mask;
116 typedef struct xenoprof_counter xenoprof_counter_t;
117 DEFINE_XEN_GUEST_HANDLE(xenoprof_counter_t);
119 typedef struct xenoprof_passive {
120 uint16_t domain_id;
121 int32_t max_samples;
122 int32_t nbuf;
123 int32_t bufsize;
124 uint64_t buf_gmaddr;
125 } xenoprof_passive_t;
126 DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t);
129 #endif /* __XEN_PUBLIC_XENOPROF_H__ */
132 * Local variables:
133 * mode: C
134 * c-set-style: "BSD"
135 * c-basic-offset: 4
136 * tab-width: 4
137 * indent-tabs-mode: nil
138 * End: