Skip to content

Commit 5f46dca

Browse files
authored
Reset marker (#5)
* first link of pytraskr (now making the examples work) * adding examples * style fix * adding new README * why was this removed? * tracr reset SET marker method * moving the reset marker into the pthreads example * much more elegant meson.build example file
1 parent f60f505 commit 5f46dca

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ build:
1010
- source /home/hicr/.hicr-env.sh
1111
- echo "Building TraCR..."
1212
- mkdir build
13-
- meson setup build -DbuildExamples=true -DcompileWarningsAsErrors=true -Dbuildtype=debug -Db_coverage=true
13+
- meson setup build -DbuildPyTraCR=true -DbuildTests=true -DbuildExamples=true -DcompileWarningsAsErrors=true -Dbuildtype=debug -Db_coverage=true
1414
- meson compile -C build
1515
- echo "Running tests..."
1616
- meson test -C build

examples/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ foreach args : cpp_args_list
5050
if get_option('buildPyTraCR') and instrumentation_enabled and (test_type != 'pthread_example')
5151

5252
test_name = 'pyTraCR_' + test_name
53-
workdir = meson.current_source_dir() + '/' + test_name + '_out/'
53+
workdir = meson.project_build_root() + '/examples/' + test_name + '_out/'
5454

5555
# Create the output directory before tests
5656
create_dirs = custom_target('create_pytracr_dirs' + test_name,
@@ -61,7 +61,7 @@ foreach args : cpp_args_list
6161

6262
test(test_name,
6363
py,
64-
args: ['../pytracr/' + test_type + '.py'],
64+
args: [meson.current_source_dir() + '/pytracr/' + test_type + '.py'],
6565
env: ['PYTHONPATH=' + meson.project_build_root() + '/include/pytracr/'],
6666
suite: testSuite,
6767
workdir: workdir,

examples/pthread_example.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ void *threadFunction(void *arg) {
6262

6363
INSTRUMENTATION_THREAD_MARK_SET(thrd_finished_id);
6464

65+
// Optional: This marker pushes the int64_t max value. Can be used to indicate
66+
// the ending.
67+
INSTRUMENTATION_VMARKER_RESET();
68+
6569
// TraCR free thread
6670
INSTRUMENTATION_THREAD_END();
6771

include/pytracr/pytracr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ static void instrumentation_vmarker_set(size_t value) {
7676
INSTRUMENTATION_VMARKER_SET(value);
7777
}
7878

79+
static void instrumentation_vmarker_reset() { INSTRUMENTATION_VMARKER_RESET(); }
80+
7981
static void instrumentation_vmarker_push(size_t value) {
8082
INSTRUMENTATION_VMARKER_PUSH(value);
8183
}
@@ -122,6 +124,7 @@ PYBIND11_MODULE(tracr, m) {
122124
m.def("INSTRUMENTATION_VMARKER_TYPE", &instrumentation_vmarker_type, "");
123125
m.def("INSTRUMENTATION_VMARKER_LABEL", &instrumentation_vmarker_label, "");
124126
m.def("INSTRUMENTATION_VMARKER_SET", &instrumentation_vmarker_set, "");
127+
m.def("INSTRUMENTATION_VMARKER_RESET", &instrumentation_vmarker_reset, "");
125128
m.def("INSTRUMENTATION_VMARKER_PUSH", &instrumentation_vmarker_push, "");
126129
m.def("INSTRUMENTATION_VMARKER_POP", &instrumentation_vmarker_pop, "");
127130

src/tracr.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ extern ThreadMarkerMap thread_marker_map;
152152
thread_marker_map.pop(idx);
153153

154154
/**
155-
* ovni marker methods (vanilla) (only used for performance comparisons)
155+
* ovni marker methods (vanilla)
156156
*/
157157
#define INSTRUMENTATION_VMARKER_TYPE(flag, title) ovni_mark_type(0, flag, title)
158158

@@ -163,6 +163,10 @@ extern ThreadMarkerMap thread_marker_map;
163163
debug_print("instr_marker_set (TID: %d)", get_tid()); \
164164
ovni_mark_set(0, value)
165165

166+
#define INSTRUMENTATION_VMARKER_RESET() \
167+
debug_print("instr_marker_reset (TID: %d)", get_tid()); \
168+
ovni_mark_set(0, INT64_MAX)
169+
166170
#define INSTRUMENTATION_VMARKER_PUSH(value) \
167171
debug_print("instr_marker_push (TID: %d)", get_tid()); \
168172
ovni_mark_push(0, value)
@@ -218,6 +222,8 @@ extern ThreadMarkerMap thread_marker_map;
218222

219223
#define INSTRUMENTATION_VMARKER_SET(value) (void)(value)
220224

225+
#define INSTRUMENTATION_VMARKER_RESET()
226+
221227
#define INSTRUMENTATION_VMARKER_PUSH(value) (void)(value)
222228

223229
#define INSTRUMENTATION_VMARKER_POP(value) (void)(value)

0 commit comments

Comments
 (0)