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

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [test_suite0/] [src/] [perf/] [simple.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Copyright (C) 2010 B Labs Ltd.
3
 *
4
 * l4_getid performance tests
5
 *
6
 * Author: Bahadir Balban
7
 */
8
#include <l4lib/macros.h>
9
#include L4LIB_INC_ARCH(syslib.h)
10
#include L4LIB_INC_ARCH(syscalls.h)
11
#include <l4lib/lib/thread.h>
12
#include <l4lib/perfmon.h>
13
#include <perf.h>
14
#include <tests.h>
15
#include <string.h>
16
 
17
struct perfmon_cycles simple_cycles;
18
 
19
#define PERFTEST_SIMPLE_LOOP    2000
20
 
21
void perf_test_simple(void)
22
{
23
        dbg_printf("%s: This will test the cycle count of basic loops.\n",
24
                   __FUNCTION__);
25
 
26
        /*
27
         * Initialize structures
28
         */
29
        memset(&simple_cycles, 0, sizeof(struct perfmon_cycles));
30
        simple_cycles.min = ~0; /* Init as maximum possible */
31
 
32
        /*
33
         * Do the test
34
         */
35
        perfmon_reset_start_cyccnt();
36
        for (int i = 0; i < PERFTEST_SIMPLE_LOOP; i++)
37
                ;
38
 
39
        perfmon_record_cycles(&simple_cycles,"empty_loop");
40
 
41
        /*
42
         * Calculate average
43
         */
44
        simple_cycles.avg = simple_cycles.total / simple_cycles.ops;
45
 
46
        /*
47
         * Print results
48
         */
49
        printf("%s took %llu min, %llu max, %llu avg, in %llu ops.\n",
50
               "simple loop",
51
               simple_cycles.min * USEC_MULTIPLIER,
52
               simple_cycles.max * USEC_MULTIPLIER,
53
               simple_cycles.avg * USEC_MULTIPLIER,
54
               simple_cycles.ops);
55
}
56
 

powered by: WebSVN 2.1.0

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