diff options
author | erdgeist@erdgeist.org <erdgeist@bauklotz.fritz.box> | 2019-07-04 23:26:09 +0200 |
---|---|---|
committer | erdgeist@erdgeist.org <erdgeist@bauklotz.fritz.box> | 2019-07-04 23:26:09 +0200 |
commit | f02dfce6e6c34b3d8a7b8a0e784b506178e331fa (patch) | |
tree | 45556e6104242d4702689760433d7321ae74ec17 /machdep.h |
stripdown of version 0.9
Diffstat (limited to 'machdep.h')
-rw-r--r-- | machdep.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/machdep.h b/machdep.h new file mode 100644 index 0000000..4dff9ba --- /dev/null +++ b/machdep.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | |||
3 | FILE........: machdep.h | ||
4 | AUTHOR......: David Rowe | ||
5 | DATE CREATED: May 2 2013 | ||
6 | |||
7 | Machine dependant functions, e.g. profiling that requires access to a clock | ||
8 | counter register. | ||
9 | |||
10 | \*---------------------------------------------------------------------------*/ | ||
11 | |||
12 | /* | ||
13 | Copyright (C) 2013 David Rowe | ||
14 | |||
15 | All rights reserved. | ||
16 | |||
17 | This program is free software; you can redistribute it and/or modify | ||
18 | it under the terms of the GNU Lesser General Public License version 2.1, as | ||
19 | published by the Free Software Foundation. This program is | ||
20 | distributed in the hope that it will be useful, but WITHOUT ANY | ||
21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
22 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
23 | License for more details. | ||
24 | |||
25 | You should have received a copy of the GNU Lesser General Public License | ||
26 | along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
27 | */ | ||
28 | |||
29 | #ifndef __MACHDEP__ | ||
30 | #define __MACHDEP__ | ||
31 | |||
32 | #ifdef PROFILE | ||
33 | #define PROFILE_VAR(...) unsigned int __VA_ARGS__ | ||
34 | #define PROFILE_SAMPLE(timestamp) timestamp = machdep_profile_sample() | ||
35 | #define PROFILE_SAMPLE_AND_LOG(timestamp, prev_timestamp, label) \ | ||
36 | timestamp = machdep_profile_sample_and_log(prev_timestamp, label) | ||
37 | #define PROFILE_SAMPLE_AND_LOG2(prev_timestamp, label) \ | ||
38 | machdep_profile_sample_and_log(prev_timestamp, label) | ||
39 | #else | ||
40 | #define PROFILE_VAR(...) | ||
41 | #define PROFILE_SAMPLE(timestamp) | ||
42 | #define PROFILE_SAMPLE_AND_LOG(timestamp, prev_timestamp, label) | ||
43 | #define PROFILE_SAMPLE_AND_LOG2(prev_timestamp, label) | ||
44 | #endif | ||
45 | |||
46 | void machdep_profile_init(void); | ||
47 | void machdep_profile_reset(void); | ||
48 | unsigned int machdep_profile_sample(void); | ||
49 | unsigned int machdep_profile_sample_and_log(unsigned int start, char s[]); | ||
50 | void machdep_profile_print_logged_samples(void); | ||
51 | |||
52 | #endif | ||