ClickHouse/base/common/coverage.cpp

32 lines
538 B
C++
Raw Normal View History

#include "coverage.h"
#if WITH_COVERAGE
# include <mutex>
# include <unistd.h>
# if defined(__clang__)
2020-09-17 14:44:46 +00:00
extern "C" void __llvm_profile_dump(); // NOLINT
# elif defined(__GNUC__) || defined(__GNUG__)
extern "C" void __gcov_exit();
# endif
#endif
void dumpCoverageReportIfPossible()
{
#if WITH_COVERAGE
static std::mutex mutex;
std::lock_guard lock(mutex);
# if defined(__clang__)
2020-09-17 14:44:46 +00:00
__llvm_profile_dump(); // NOLINT
# elif defined(__GNUC__) || defined(__GNUG__)
__gcov_exit();
# endif
#endif
}