Resync with broadcom drivers 5.100.138.20 and utilities.
[tomato.git] / release / src-rt / include / bcmperf.h
blob6f2953638e6b3db3fded92d436af45499c854f91
1 /*
2 * Performance counters software interface.
4 * Copyright (C) 2010, Broadcom Corporation. All Rights Reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 * $Id: bcmperf.h,v 13.5 2007-09-14 22:00:59 Exp $
20 /* essai */
21 #ifndef _BCMPERF_H_
22 #define _BCMPERF_H_
23 /* get cache hits and misses */
24 #if defined(BCMMIPS) && defined(BCMPERFSTATS)
25 #include <hndmips.h>
26 #define BCMPERF_ENABLE_INSTRCOUNT() hndmips_perf_instrcount_enable()
27 #define BCMPERF_ENABLE_ICACHE_MISS() hndmips_perf_icache_miss_enable()
28 #define BCMPERF_ENABLE_ICACHE_HIT() hndmips_perf_icache_hit_enable()
29 #define BCMPERF_GETICACHE_MISS(x) ((x) = hndmips_perf_read_cache_miss())
30 #define BCMPERF_GETICACHE_HIT(x) ((x) = hndmips_perf_read_cache_hit())
31 #define BCMPERF_GETINSTRCOUNT(x) ((x) = hndmips_perf_read_instrcount())
32 #else
33 #define BCMPERF_ENABLE_INSTRCOUNT()
34 #define BCMPERF_ENABLE_ICACHE_MISS()
35 #define BCMPERF_ENABLE_ICACHE_HIT()
36 #define BCMPERF_GETICACHE_MISS(x) ((x) = 0)
37 #define BCMPERF_GETICACHE_HIT(x) ((x) = 0)
38 #define BCMPERF_GETINSTRCOUNT(x) ((x) = 0)
39 #endif /* defined(mips) */
40 #endif /* _BCMPERF_H_ */