Skip to content

Commit b56466d

Browse files
dump is a failure
1 parent eac5b82 commit b56466d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/profiler.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,12 +1306,10 @@ Error Profiler::start(Arguments& args, bool reset) {
13061306

13071307
Error Profiler::stop(bool restart) {
13081308
MutexLocker ml(_state_lock);
1309-
if (_start_time == TERMINATED) {
1309+
if (_state == TERMINATED) {
13101310
Log::debug("Skipping stop action due to terminated profiler");
13111311
return Error::TERMINATED;
1312-
}
1313-
1314-
if (_state != RUNNING) {
1312+
} else if (_state != RUNNING) {
13151313
return Error("Profiler is not active");
13161314
}
13171315

@@ -1376,9 +1374,7 @@ Error Profiler::dump(Writer& out, Arguments& args) {
13761374
if (_state == TERMINATED) {
13771375
Log::debug("Skipping dump action due to terminated profiler");
13781376
return Error::TERMINATED;
1379-
}
1380-
1381-
if (_state != IDLE && _state != RUNNING) {
1377+
} else if (_state != IDLE && _state != RUNNING) {
13821378
return Error("Profiler has not started");
13831379
}
13841380

@@ -1931,6 +1927,10 @@ Error Profiler::runInternal(Arguments& args, Writer& out) {
19311927
}
19321928
case ACTION_DUMP: {
19331929
Error error = dump(out, args);
1930+
if (error.message() == TERMINATED_MESSAGE && args._action == ACTION_DUMP) {
1931+
return Error("Unable to dump results after profiler termination");
1932+
}
1933+
19341934
if (error) {
19351935
return error;
19361936
}

0 commit comments

Comments
 (0)