Skip to content

Commit

Permalink
Forget them dang #ifdef guards
Browse files Browse the repository at this point in the history
  • Loading branch information
cvonelm committed Nov 15, 2023
1 parent ead4091 commit 68c5a27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#include <lo2s/log.hpp>
#include <lo2s/perf/counter/counter_provider.hpp>
#include <lo2s/perf/event_provider.hpp>
#ifdef HAVE_LIBPFM
#include <lo2s/perf/pfm.hpp>
#endif
#include <lo2s/perf/tracepoint/format.hpp>
#include <lo2s/perf/util.hpp>
#include <lo2s/platform.hpp>
Expand Down Expand Up @@ -426,8 +428,11 @@ void parse_program_options(int argc, const char** argv)
print_availability(std::cout, "Kernel PMU events",
perf::EventProvider::get_pmu_events());

#ifdef HAVE_LIBPFM
print_availability(std::cout, "Libpfm events",
perf::PFM4::instance().get_pfm4_events());
#endif

std::cout << "(* Only available in process-monitoring mode" << std::endl;
std::cout << "(# Only available in system-monitoring mode" << std::endl;

Expand Down
7 changes: 7 additions & 0 deletions src/perf/event_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <lo2s/log.hpp>
#include <lo2s/perf/event_description.hpp>
#include <lo2s/perf/event_provider.hpp>
#ifdef HAVE_LIBPFM
#include <lo2s/perf/pfm.hpp>
#endif
#include <lo2s/perf/util.hpp>
#include <lo2s/topology.hpp>
#include <lo2s/util.hpp>
Expand Down Expand Up @@ -619,6 +621,7 @@ EventDescription EventProvider::cache_event(const std::string& name)
}
catch (const InvalidEvent& e)
{
#ifdef HAVE_LIBPFM
EventDescription ev = PFM4::instance().pfm4_read_event(name);
if (ev.availability == Availability::UNAVAILABLE)
{
Expand All @@ -627,6 +630,10 @@ EventDescription EventProvider::cache_event(const std::string& name)
}

return ev;
#else
event_map_.emplace(name, DescriptionCache::make_invalid());
throw e;
#endif
}
}

Expand Down

0 comments on commit 68c5a27

Please sign in to comment.