FreeBSD/Linux Kernel Cross Reference
sys/sys/pmc.h
1 /* $NetBSD: pmc.h,v 1.2 2002/08/08 16:23:19 thorpej Exp $ */
2
3 /*
4 * Copyright (c) 2002 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Allen Briggs for Wasabi Systems, Inc.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed for the NetBSD Project by
20 * Wasabi Systems, Inc.
21 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 * or promote products derived from this software without specific prior
23 * written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38 #ifndef _SYS_PMC_H_
39 #define _SYS_PMC_H_
40
41 struct pmc_counter_cfg {
42 pmc_evid_t event_id; /* What event to configure */
43 pmc_ctr_t reset_value; /* Value to set counter to */
44 uint32_t flags; /* PMC_FLAG_* */
45 };
46
47 #if defined(_KERNEL)
48
49 /*
50 * The following functions are defined in machine/pmc.h as either
51 * functions or macros.
52 *
53 * int pmc_get_num_counters(void);
54 *
55 * void pmc_save_context(struct proc *p);
56 * void pmc_restore_context(struct proc *p);
57 *
58 * int pmc_enable_counter(struct proc *p, int ctr);
59 * int pmc_disable_counter(struct proc *p, int ctr);
60 * int pmc_counter_isrunning(struct proc *p, int ctr);
61 * int pmc_counter_isconfigured(struct proc *p, int ctr);
62 *
63 * int pmc_configure_counter(struct proc *p, int ctr, pmc_counter_cfg *cfg);
64 *
65 * int pmc_get_counter_value(struct proc *p, int ctr, int flags,
66 * uint64_t *pval);
67 *
68 * int pmc_accumulate(struct proc *p_parent, struct proc *p_exiting);
69 *
70 * int pmc_alloc_kernel_counter(int ctr, struct pmc_counter_cfg *cfg);
71 * int pmc_free_kernel_counter(int ctr);
72 *
73 * int pmc_start_profiling(int ctr, struct pmc_counter_cfg *cfg);
74 * int pmc_stop_profiling(int ctr);
75 *
76 * int PMC_ENABLED(struct proc *p);
77 */
78
79 #define PMC_VALUE_FLAGS_CHILDREN 0x00000001
80
81 #endif /* _KERNEL */
82
83 #include <machine/pmc.h>
84
85 #define PMC_OP_START 1
86 #define PMC_OP_STOP 2
87 #define PMC_OP_CONFIGURE 3
88 #define PMC_OP_PROFSTART 4
89 #define PMC_OP_PROFSTOP 5
90 int pmc_control(int ctr, int operation, void *args);
91
92 #define PMC_INFO_NCOUNTERS 1
93 #define PMC_INFO_CPUCTR_TYPE 2
94 #define PMC_INFO_COUNTER_VALUE 3
95 #define PMC_INFO_ACCUMULATED_COUNTER_VALUE 4
96 int pmc_get_info(int ctr, int request, void *data);
97
98 #endif /* !_SYS_PMC_H_ */
Cache object: 00a23b531f1fad66b117befd0ebecac4
|