-
Notifications
You must be signed in to change notification settings - Fork 2
/
scm.h
40 lines (32 loc) · 1.04 KB
/
scm.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
/*
* Copyright (c) 2010, the Short-term Memory Project Authors.
* All rights reserved. Please see the AUTHORS file for details.
* Use of this source code is governed by a BSD license that
* can be found in the LICENSE file.
*/
#ifndef _SCM_H_
#define _SCM_H_
#include <stdio.h>
#include <stdbool.h>
#include <pthread.h>
#include <limits.h>
#include "debug.h"
#include "arch.h"
#include "object.h"
#include "descriptors.h"
#include "libscm.h"
#ifdef SCM_MAKE_MICROBENCHMARKS
#define MICROBENCHMARK_START unsigned long long _mb_start = rdtsc();
#define MICROBENCHMARK_STOP unsigned long long _mb_stop = rdtsc();
#define MICROBENCHMARK_DURATION(_location) \
printf("microbenchmark_at_%s:\t%llu\n", _location, (_mb_stop-_mb_start));
#else
#define MICROBENCHMARK_START //NOOP
#define MICROBENCHMARK_STOP //NOOP
#define MICROBENCHMARK_DURATION(_location) //NOOP
#endif
#define HB_MASK (UINT_MAX - INT_MAX)
#define CACHEALIGN(x) (ROUND_UP(x,8))
#define ROUND_UP(x,y) (ROUND_DOWN(x+(y-1),y))
#define ROUND_DOWN(x,y) ((x) & ~(y-1))
#endif /* _SCM_H_ */