From 069d6ff621239c8d200a77c526b6755fefcfe1c8 Mon Sep 17 00:00:00 2001 From: weiyu Date: Mon, 24 Jun 2019 12:43:31 -0700 Subject: [PATCH] add run time library for function entries and exits --- cmodelint.cc | 10 ++++++++++ include/cmodelint.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/cmodelint.cc b/cmodelint.cc index 348051a0..3dbb437b 100644 --- a/cmodelint.cc +++ b/cmodelint.cc @@ -358,3 +358,13 @@ void cds_atomic_thread_fence(int atomic_index, const char * position) { __old__ = __old__; Silence clang (-Wunused-value) \ }) */ + +void cds_func_entry(const char * funcName) { + Thread * th = thread_current(); + printf("thread %d Enter function %s\n", th->get_id(), funcName); +} + +void cds_func_exit(const char * funcName) { + Thread * th = thread_current(); + printf("thread %d Exit from function %s\n", th->get_id(), funcName); +} diff --git a/include/cmodelint.h b/include/cmodelint.h index 8530827c..9e82c030 100644 --- a/include/cmodelint.h +++ b/include/cmodelint.h @@ -98,6 +98,9 @@ bool cds_atomic_compare_exchange64_v2(void* addr, uint64_t* expected, uint64_t d // cds atomic thread fence void cds_atomic_thread_fence(int atomic_index, const char * position); +void cds_func_entry(const char * funcName); +void cds_func_exit(const char * funcName); + #if __cplusplus } #endif -- 2.34.1