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

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [src/] [glue/] [arm/] [debug.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
 
2
#include <l4/generic/preempt.h>
3
#include <l4/generic/debug.h>
4
#include INC_SUBARCH(perfmon.h)
5
#include INC_GLUE(debug.h)
6
 
7
#if defined (CONFIG_DEBUG_PERFMON_KERNEL)
8
 
9
#define CYCLES_PER_COUNTER_TICKS                                64
10
void system_measure_syscall_end(unsigned long swi_address)
11
{
12
        volatile u64 cnt = perfmon_read_cyccnt() * CYCLES_PER_COUNTER_TICKS;
13
        unsigned int call_offset = (swi_address & 0xFF) >> 2;
14
 
15
        /* Number of syscalls */
16
        u64 call_count =
17
                *(((u64 *)&system_accounting.syscalls) + call_offset);
18
 
19
        /* System call timing structure */
20
        struct syscall_timing *st =
21
                (struct syscall_timing *)
22
                        &system_accounting.syscall_timings + call_offset;
23
 
24
        /* Set min */
25
        if (st->min == 0)
26
               st->min = cnt;
27
        else if (st->min > cnt)
28
                st->min = cnt;
29
 
30
        /* Set max */
31
        if (st->max < cnt)
32
                st->max = cnt;
33
 
34
        st->total += cnt;
35
 
36
        /* Average = total timings / total calls */
37
        st->avg = st->total / call_count;
38
 
39
        /* Update total */
40
        system_accounting.syscall_timings.all_total += cnt;
41
}
42
 
43
#endif

powered by: WebSVN 2.1.0

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