-
Notifications
You must be signed in to change notification settings - Fork 0
/
osm.h
51 lines (37 loc) · 1.36 KB
/
osm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef _OSM_H
#define _OSM_H
/* calling a system call that does nothing */
#define OSM_NULLSYSCALL asm volatile( "int $0x80 " : : \
"a" (0xffffffff) /* no such syscall */, "b" (0), "c" (0), "d" (0) /*:\
"eax", "ebx", "ecx", "edx"*/)
/* Initialization function that the user must call
* before running any other library function.
* The function may, for example, allocate memory or
* create/open files.
* Pay attention: this function may be empty for some desings. It's fine.
* Returns 0 uppon success and -1 on failure
*/
int osm_init();
/* finalizer function that the user must call
* after running any other library function.
* The function may, for example, free memory or
* close/delete files.
* Returns 0 uppon success and -1 on failure
*/
int osm_finalizer();
/* Time measurement function for a simple arithmetic operation.
returns time in nano-seconds upon success,
and -1 upon failure.
*/
double osm_operation_time(unsigned int iterations);
/* Time measurement function for an empty function call.
returns time in nano-seconds upon success,
and -1 upon failure.
*/
double osm_function_time(unsigned int iterations);
/* Time measurement function for an empty trap into the operating system.
returns time in nano-seconds upon success,
and -1 upon failure.
*/
double osm_syscall_time(unsigned int iterations);
#endif