#include <dpl/foreach.h>
#include <dpl/log/log.h>
#include <dpl/mutex.h>
+#include <dpl/static_block.h>
+#include <dpl/assert.h>
namespace {
const int PROFILING_OUTPUT_DESCRIPTOR = 3;
dumpStatistic();
}
-int initialize();
-
-const int i = initialize();
DPL::Mutex* m_mutex = NULL;
-int initialize()
+void initialize()
{
- (void)i;
m_mutex = new DPL::Mutex;
results.reserve(64 * 1024);
signal(SIGUSR1, &sigUsrHandler);
signal(SIGUSR2, &sigUsrHandler);
LogDebug("Initialized profiling");
AddProfilingMeasurment("Profiling_Started");
- return 1;
}
std::string GetFormattedTime()
void AddStdoutProfilingMeasurment(const char* name, bool start)
{
+ Assert(m_mutex != NULL);
std::ostringstream output;
output << "[" << GetFormattedTime() << "] [](): " << name << " ";
output << (start ? "profiling##start" : "profiling##stop");
results.push_back(
PacketResult(toULong(value), name, prefix, description));
}
+
+STATIC_BLOCK
+{
+ initialize();
+}
+