OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [include/] [l4/] [generic/] [debug.h] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Definitions for kernel entry accounting.
3
 *
4
 * Copyright (C) 2010 B Labs Ltd.
5
 *
6
 * Written by Bahadir Balban
7
 */
8
#ifndef __GENERIC_DEBUG_H__
9
#define __GENERIC_DEBUG_H__
10
 
11
#include INC_ARCH(types.h)
12
#include INC_SUBARCH(cache.h)
13
#include <l4/lib/printk.h>
14
 
15
#if defined(CONFIG_DEBUG_ACCOUNTING)
16
 
17
struct exception_count {
18
        u64 syscall;
19
        u64 data_abort;
20
        u64 prefetch_abort;
21
        u64 irq;
22
        u64 undefined_abort;
23
};
24
 
25
/*
26
 * Note these are packed to match systable offsets
27
 * so that they're incremented with an auccess
28
 */
29
struct syscall_count {
30
        u64 ipc;
31
        u64 tswitch;
32
        u64 tctrl;
33
        u64 exregs;
34
        u64 emtpy;
35
        u64 unmap;
36
        u64 irqctrl;
37
        u64 empty1;
38
        u64 map;
39
        u64 getid;
40
        u64 capctrl;
41
        u64 empty2;
42
        u64 time;
43
        u64 mutexctrl;
44
        u64 cachectrl;
45
} __attribute__ ((__packed__));
46
 
47
struct task_op_count {
48
        u64 context_switch;
49
        u64 space_switch;
50
};
51
 
52
struct cache_op_count {
53
        u64 dcache_clean_mva;
54
        u64 dcache_inval_mva;
55
        u64 icache_clean_mva;
56
        u64 icache_inval_mva;
57
        u64 dcache_clean_setway;
58
        u64 dcache_inval_setway;
59
        u64 tlb_mva;
60
};
61
 
62
#if defined(CONFIG_DEBUG_PERFMON_KERNEL)
63
 
64
/* Minimum, maximum and average timings for the call */
65
struct syscall_timing {
66
        u64 total;
67
        u32 min;
68
        u32 max;
69
        u32 avg;
70
};
71
 
72
struct syscall_timings {
73
        struct syscall_timing ipc;
74
        struct syscall_timing tswitch;
75
        struct syscall_timing tctrl;
76
        struct syscall_timing exregs;
77
        struct syscall_timing emtpy;
78
        struct syscall_timing unmap;
79
        struct syscall_timing irqctrl;
80
        struct syscall_timing empty1;
81
        struct syscall_timing map;
82
        struct syscall_timing getid;
83
        struct syscall_timing capctrl;
84
        struct syscall_timing empty2;
85
        struct syscall_timing time;
86
        struct syscall_timing mutexctrl;
87
        struct syscall_timing cachectrl;
88
        u64 all_total;
89
} __attribute__ ((__packed__));
90
 
91
extern struct syscall_timings syscall_timings;
92
 
93
 
94
#endif /* End of CONFIG_DEBUG_PERFMON_KERNEL */
95
 
96
struct system_accounting {
97
        struct syscall_count syscalls;
98
 
99
#if defined(CONFIG_DEBUG_PERFMON_KERNEL)
100
        struct syscall_timings syscall_timings;
101
#endif
102
 
103
        struct exception_count exceptions;
104
        struct cache_op_count cache_ops;
105
        struct task_op_count task_ops;
106
} __attribute__ ((__packed__));
107
 
108
 
109
extern struct system_accounting system_accounting;
110
 
111
static inline void system_account_dabort(void)
112
{
113
        system_accounting.exceptions.data_abort++;
114
}
115
 
116
static inline void system_account_pabort(void)
117
{
118
        system_accounting.exceptions.prefetch_abort++;
119
}
120
 
121
static inline void system_account_undef_abort(void)
122
{
123
        system_accounting.exceptions.undefined_abort++;
124
}
125
 
126
static inline void system_account_irq(void)
127
{
128
        system_accounting.exceptions.irq++;
129
}
130
 
131
static inline void system_account_syscall(void)
132
{
133
        system_accounting.exceptions.syscall++;
134
}
135
 
136
static inline void system_account_context_switch(void)
137
{
138
        system_accounting.task_ops.context_switch++;
139
}
140
 
141
static inline void system_account_space_switch(void)
142
{
143
        system_accounting.task_ops.space_switch++;
144
}
145
 
146
#include INC_SUBARCH(debug.h)
147
 
148
#else /* End of CONFIG_DEBUG_ACCOUNTING */
149
 
150
static inline void system_account_cache_op(int op) { }
151
static inline void system_account_irq(void) { }
152
static inline void system_account_syscall(void) { }
153
static inline void system_account_dabort(void) { }
154
static inline void system_account_pabort(void) { }
155
static inline void system_account_undef_abort(void) { }
156
static inline void system_account_space_switch(void) { }
157
static inline void system_account_context_switch(void) { }
158
 
159
#endif /* End of !CONFIG_DEBUG_ACCOUNTING */
160
 
161
 
162
#endif /* __GENERIC_DEBUG_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.