Skip to content

v1.1.0

Choose a tag to compare

@jmuehlig jmuehlig released this 22 Aug 11:39
· 11 commits to dev since this release
  • License: perf-cpp is now licensed under the Apache License 2.0 (instead of LGPL-3.0), making it easier to use in both open-source and commercial projects.
  • Sampler::close() unmaps the sample buffers and discards all recorded samples. Calling Sampler::result() or Sampler::to_perf_file() afterwards previously returned an empty result (respectively wrote an empty perf file) without any indication that samples were dropped; both now throw perf::CannotGetResultFromClosedSamplerError. Read the samples after stopping, but before closing the sampler (see the sampling documentation). This also applies to MultiThreadSampler and MultiCoreSampler. result() on a sampler that was never opened still returns an empty result, since nothing was recorded in that case.
  • Added CounterDefinition::is_available(name), which checks whether an event, metric, or time event can actually be opened on the current hardware by attempting a real perf_event_open() call (supports() only checks whether it's defined). For metrics, all required events, including those recursively referenced, are also probed.
  • cmake now fails immediately with a clear error if the compiler is older than GCC 11 or Clang 14, instead of failing deep inside compilation.
  • cmake no longer builds Release with debug information; use -DCMAKE_BUILD_TYPE=RelWithDebInfo for an optimized build with full debug information. This shrinks the installed static library from roughly 65 MB to 2.5 MB.
  • clang-tidy is now controlled by the ENABLE_CLANG_TIDY option (default ON when building perf-cpp standalone, OFF otherwise), so embedded and packaged builds no longer lint the library.
  • cmake no longer forces CMAKE_CXX_STANDARD to 17 when the consuming toolchain already requested a newer standard.
  • create_error_message_from_code() returns a std::string_view instead of an allocated std::string, since the caller only ever appends it into another string (thanks to @horenmar, see PR #13).
  • The test binary is now registered as a CTest test, so it can be run via ctest (including in parallel with ctest -j), with failing and skipped tests reported separately (thanks to @horenmar, see PR #14).
  • Further Bugfixes:
    • EventCounter::add() threw itself into infinite recursion when metrics referenced each other cyclically. It now throws CannotEvaluateMetricsBecauseOfCycleError, naming the offending metric.
    • SharedFileDescriptor built from an invalid (negative) file descriptor, e.g., an invalid cgroup descriptor, used to report itself as valid anyway. SharedFileDescriptor{-1} no longer takes ownership.
    • EventCounter::close() and Sampler::close() clean up groups and buffers even when open() threw partway through, so a failed open no longer leaks file descriptors.
    • The global CounterDefinition instance is now allocated lazily and thread-safely.
    • CounterDefinition::metric_names() and time_event_names() no longer return duplicate names when the same metric or time event exists in both a child instance and its parent.