Skip to content

Commit

Permalink
Adress requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cvonelm committed Apr 27, 2023
1 parent 1f5cce8 commit 2e26b27
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ add_feature_info("USE_LIBAUDIT" USE_LIBAUDIT "Use libaudit for syscall name reso

# system configuration checks
CHECK_INCLUDE_FILES(linux/hw_breakpoint.h HAVE_HW_BREAKPOINT_H)
CHECK_STRUCT_HAS_MEMBER("struct perf_event_attr" clockid linux/perf_event.h HAVE_PERF_EVENT_ATTR_CLOCKID)

if(NOT HAVE_PERF_EVENT_ATTR_CLOCKID)
message(FATAL_ERROR "The system is not able to use custom reference clocks for perf events. Make sure that you are running on system that supports use_clockid with perf")
endif()

check_function_exists(clock_gettime CLOCK_GETTIME_FOUND)
if(NOT CLOCK_GETTIME_FOUND)
set(CMAKE_REQUIRED_LIBRARIES "rt")
Expand Down
2 changes: 1 addition & 1 deletion src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ void parse_program_options(int argc, const char** argv)
const auto& clock = lo2s::time::ClockProvider::get_clock_by_name(requested_clock_name);

lo2s::Log::debug() << "Using clock \'" << clock.name << "\'.";
#if !defined(USE_HW_BREAKPOINT_COMPAT)
#ifndef USE_HW_BREAKPOINT_COMPAT
config.use_clockid = true;
config.clockid = clock.id;
#else
Expand Down
4 changes: 2 additions & 2 deletions src/perf/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct perf_event_attr common_perf_event_attrs()
attr.size = sizeof(struct perf_event_attr);
attr.disabled = 1;

#if !defined(USE_HW_BREAKPOINT_COMPAT)
#ifndef USE_HW_BREAKPOINT_COMPAT
attr.use_clockid = config().use_clockid;
attr.clockid = config().clockid;
#endif
Expand Down Expand Up @@ -125,7 +125,7 @@ int perf_event_description_open(ExecutionScope scope, const EventDescription& de
// Needed when scaling multiplexed events, and recognize activation phases
perf_attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_TOTAL_TIME_RUNNING;

#if !defined(USE_HW_BREAKPOINT_COMPAT)
#ifndef USE_HW_BREAKPOINT_COMPAT
perf_attr.use_clockid = config().use_clockid;
perf_attr.clockid = config().clockid;
#endif
Expand Down

0 comments on commit 2e26b27

Please sign in to comment.