summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Lekarev <o.lekarev@samsung.com>2023-06-14 16:06:02 +0300
committerGleb Balykov/Advanced System SW Lab /SRR/Staff Engineer/Samsung Electronics <g.balykov@samsung.com>2023-06-20 21:15:36 +0300
commit3991093eca2a17a21f4ae26d7e1b28275a83d615 (patch)
tree8d5e65d708bfbea165b5d853405d49aac86580c8
parentd7095ac9cf6346f6feb6b7af1857228078a49545 (diff)
downloadheaptrack-3991093eca2a17a21f4ae26d7e1b28275a83d615.tar.gz
heaptrack-3991093eca2a17a21f4ae26d7e1b28275a83d615.tar.bz2
heaptrack-3991093eca2a17a21f4ae26d7e1b28275a83d615.zip
Disable writing SMAPS.
This functionality is not needed for profiling managed code, but may be enabled in the future for interop (managed/unmanaged) profiling.
-rw-r--r--src/track/libheaptrack.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/track/libheaptrack.cpp b/src/track/libheaptrack.cpp
index 138e8f8..eb246da 100644
--- a/src/track/libheaptrack.cpp
+++ b/src/track/libheaptrack.cpp
@@ -330,7 +330,9 @@ public:
debugLog<MinimalOutput>("%s", "shutdown()");
+#ifdef WRITE_SMAPS_ENABLE
writeSMAPS(*this);
+#endif
writeTimestamp();
// NOTE: we leak heaptrack data on exit, intentionally
@@ -367,6 +369,7 @@ public:
}
}
+#ifdef WRITE_SMAPS_ENABLE
void writeSMAPS(HeapTrack &heaptrack)
{
if (is_managed_mode || !s_data || !s_data->out || !s_data->procSmaps) {
@@ -477,6 +480,7 @@ public:
return;
}
}
+#endif
void handleMalloc(void* ptr, size_t size, const Trace& trace)
{
@@ -797,9 +801,9 @@ private:
timerThread = thread([&]() {
RecursionGuard::isActive = true;
debugLog<MinimalOutput>("%s", "timer thread started");
-
+#ifdef WRITE_SMAPS_ENABLE
int counter = 0;
-
+#endif
// now loop and repeatedly print the timestamp and RSS usage to the data stream
while (!stopTimerThread) {
// TODO: make interval customizable
@@ -808,11 +812,13 @@ private:
HeapTrack heaptrack([&] { return !stopTimerThread.load(); });
if (!stopTimerThread) {
+#ifdef WRITE_SMAPS_ENABLE
if (++counter == 32) {
heaptrack.writeSMAPS(heaptrack);
counter = 0;
}
+#endif
heaptrack.writeTimestamp();
}
}
@@ -871,6 +877,7 @@ private:
TraceTree traceTree;
const chrono::time_point<clock> start = clock::now();
+
atomic<bool> stopTimerThread{false};
thread timerThread;
@@ -908,7 +915,9 @@ bool heaptrack_init(const char* outputFileName, heaptrack_callback_t initBeforeC
HeapTrack heaptrack(guard);
res = heaptrack.initialize(outputFileName, initBeforeCallback, initAfterCallback, stopCallback);
+#ifdef WRITE_SMAPS_ENABLE
heaptrack.writeSMAPS(heaptrack);
+#endif
return res;
}