-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more utilities for profiling resources.
Adds more support for profiling resource performance, especially around mutable resources. Most importantly, it adds the static method `Resource.profileAllResources()`. When called before constructing the model, this method turns on profiling for virtually every resource in the model. This casts a broad net for early stages in a performance investigation, to highlight resources that are called unexpectedly frequently.
- Loading branch information
1 parent
e8bfb35
commit 27525c7
Showing
5 changed files
with
147 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
contrib/src/main/java/gov/nasa/jpl/aerie/contrib/streamline/core/Resource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,31 @@ | ||
package gov.nasa.jpl.aerie.contrib.streamline.core; | ||
|
||
import gov.nasa.jpl.aerie.contrib.streamline.core.monads.ResourceMonad; | ||
import gov.nasa.jpl.aerie.contrib.streamline.debugging.Profiling; | ||
|
||
/** | ||
* A function returning a fully-wrapped dynamics, | ||
* and the primary way models track state and report results. | ||
*/ | ||
public interface Resource<D> extends ThinResource<ErrorCatching<Expiring<D>>> { | ||
/** | ||
* Turn on profiling for all resources derived through {@link ResourceMonad} | ||
* or created by {@link MutableResource#resource}. | ||
* | ||
* <p> | ||
* Calling this method once before constructing your model will profile virtually every resource. | ||
* Profiling may be compute and/or memory intensive, and should not be used in production. | ||
* </p> | ||
* <p> | ||
* If only a few resources are suspect, you can also call {@link Profiling#profile} | ||
* directly on just those resource, rather than profiling every resource. | ||
* </p> | ||
* <p> | ||
* Call {@link Profiling#dump()} to see results. | ||
* </p> | ||
*/ | ||
static void profileAllResources() { | ||
ResourceMonad.profileAllResources(); | ||
MutableResource.profileAllResources(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.