Skip to content

Commit

Permalink
The Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nbauernfeind committed Nov 14, 2023
1 parent 8d30cc6 commit e337210
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,7 @@ protected QueryPerformanceNugget(
final RuntimeMemory runtimeMemory = RuntimeMemory.getInstance();
runtimeMemory.read(startMemorySample);

startClockEpochNanos = DateTimeUtils.millisToNanos(System.currentTimeMillis());
onBaseEntryStart();

state = QueryState.RUNNING;
state = QueryState.NOT_STARTED;
shouldLogThisAndStackParents = false;
}

Expand Down Expand Up @@ -260,6 +257,24 @@ public void markStartTime() {
startClockEpochNanos = DateTimeUtils.millisToNanos(System.currentTimeMillis());
}

@Override
public synchronized void onBaseEntryStart() {
super.onBaseEntryStart();
if (state == QueryState.RUNNING) {
throw new IllegalStateException("Nugget was already started");
}
state = QueryState.RUNNING;
}

@Override
public synchronized void onBaseEntryEnd() {
if (state != QueryState.RUNNING) {
throw new IllegalStateException("Nugget isn't running");
}
state = QueryState.SUSPENDED;
super.onBaseEntryEnd();
}

/**
* Mark this nugget {@link QueryState#FINISHED} and notify the recorder.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ private SafeCloseable resumeInternal() {

private void startCatchAll() {
catchAllNugget = nuggetFactory.createForCatchAll(queryNugget, operationNuggets.size(), this::releaseNugget);
catchAllNugget.markStartTime();
catchAllNugget.onBaseEntryStart();
}

private void stopCatchAll(final boolean abort) {
Expand Down Expand Up @@ -200,6 +202,8 @@ public synchronized QueryPerformanceNugget getNugget(@NotNull final String name,

final QueryPerformanceNugget nugget = nuggetFactory.createForOperation(
parent, operationNuggets.size(), name, inputSize, this::releaseNugget);
nugget.markStartTime();
nugget.onBaseEntryStart();
operationNuggets.add(nugget);
userNuggetStack.addLast(nugget);
return nugget;
Expand Down
2 changes: 1 addition & 1 deletion py/server/deephaven/perfmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from deephaven import DHError
from deephaven.jcompat import j_map_to_dict
from deephaven.table import Table
from deephaven.table import Table, TreeTable

_JPerformanceQueries = jpy.get_type("io.deephaven.engine.table.impl.util.PerformanceQueries")
_JMetricsManager = jpy.get_type("io.deephaven.util.metrics.MetricsManager")
Expand Down

0 comments on commit e337210

Please sign in to comment.