root / lab4 / .minix-src / include / i386 / pmc.h @ 13
History | View | Annotate | Download (3.75 KB)
1 |
/* $NetBSD: pmc.h,v 1.8 2007/04/16 19:12:18 ad Exp $ */
|
---|---|
2 |
|
3 |
/*-
|
4 |
* Copyright (c) 2000 Zembu Labs, Inc.
|
5 |
* All rights reserved.
|
6 |
*
|
7 |
* Author: Jason R. Thorpe <thorpej@zembu.com>
|
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 by Zembu Labs, Inc.
|
20 |
* 4. Neither the name of Zembu Labs nor the names of its employees may
|
21 |
* be used to endorse or promote products derived from this software
|
22 |
* without specific prior written permission.
|
23 |
*
|
24 |
* THIS SOFTWARE IS PROVIDED BY ZEMBU LABS, INC. ``AS IS'' AND ANY EXPRESS
|
25 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR-
|
26 |
* RANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS-
|
27 |
* CLAIMED. IN NO EVENT SHALL ZEMBU LABS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
29 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
30 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
31 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
32 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
33 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34 |
*/
|
35 |
|
36 |
#ifndef _I386_PMC_H_
|
37 |
#define _I386_PMC_H_
|
38 |
|
39 |
#define PMC_CLASS_I586 0x10000 /* i586-compatible */ |
40 |
#define PMC_TYPE_I586_TSC 0x10001 /* cycle counter */ |
41 |
#define PMC_TYPE_I586_PMCx 0x10002 /* performance counter */ |
42 |
|
43 |
#define PMC_CLASS_I686 0x20000 /* i686-compatible */ |
44 |
#define PMC_TYPE_I686_TSC 0x20001 /* cycle counter */ |
45 |
#define PMC_TYPE_I686_PMCx 0x20002 /* performance counter */ |
46 |
|
47 |
#define PMC_CLASS_K7 0x30000 /* K7-compatible */ |
48 |
#define PMC_TYPE_K7_TSC 0x30001 /* cycle counter */ |
49 |
#define PMC_TYPE_K7_PMCx 0x30002 /* performance counter */ |
50 |
|
51 |
/*
|
52 |
* Each PMC event on the x86 is associated with a processor unit. We
|
53 |
* encode the unit in the upper 16 bits of the event ID.
|
54 |
*/
|
55 |
#define __PMC_EVID_EVENT_MASK 0x0000ffff |
56 |
#define __PMC_EVID_UNIT_MASK 0xffff0000 |
57 |
|
58 |
#define __PMC_UNIT(x) ((x) << 16) |
59 |
#define __PMC_GET_UNIT(x) (((x) & __PMC_EVID_UNIT_MASK) >> 16) |
60 |
#define __PMC_GET_EVENT(x) ((x) & __PMC_EVID_EVENT_MASK)
|
61 |
|
62 |
#if defined(_KERNEL)
|
63 |
/*
|
64 |
* LEGACY PMC support
|
65 |
*/
|
66 |
struct x86_pmc_info_args;
|
67 |
struct x86_pmc_startstop_args;
|
68 |
struct x86_pmc_read_args;
|
69 |
int pmc_info(struct lwp *, struct x86_pmc_info_args *, |
70 |
register_t *); |
71 |
int pmc_startstop(struct lwp *, struct x86_pmc_startstop_args *, |
72 |
register_t *); |
73 |
int pmc_read(struct lwp *, struct x86_pmc_read_args *, |
74 |
register_t *); |
75 |
/* END LEGACY PMC SUPPORT */
|
76 |
|
77 |
#define pmc_md_fork(p1,p2)
|
78 |
#define pmc_get_num_counters() (0) |
79 |
#define pmc_get_counter_type(c) (0) |
80 |
#define pmc_save_context(p)
|
81 |
#define pmc_restore_context(p)
|
82 |
#define pmc_enable_counter(p,c)
|
83 |
#define pmc_disable_counter(p,c)
|
84 |
#define pmc_accumulate(p1,p2)
|
85 |
#define pmc_process_exit(p1)
|
86 |
#define pmc_counter_isconfigured(p,c) (0) |
87 |
#define pmc_counter_isrunning(p,c) (0) |
88 |
#define pmc_start_profiling(c,f) (0) |
89 |
#define pmc_stop_profiling(c) (0) |
90 |
#define pmc_alloc_kernel_counter(c,f) (0) |
91 |
#define pmc_free_kernel_counter(c) (0) |
92 |
#define pmc_configure_counter(p,c,f) (0) |
93 |
#define pmc_get_counter_value(p,c,f,pv) (0) |
94 |
|
95 |
#define PMC_ENABLED(p) (0) |
96 |
|
97 |
#endif /* _KERNEL */ |
98 |
|
99 |
#endif /* _I386_PMC_H_ */ |