Releases: perfmark/perfmark
Release 0.27.0
API Changes
- PerfMark now requires Java 8 as the minimum version.
- Added
attachStringTag
,attachIntTag
andattachLongTag
toPerfMark
. This allows passing in a lambda to lazily calculate these values. The Int and Long versions are meant to avoid int to long promotion, and primarily be using with Collections.size().
Dependency Changes
- Dropped JSR305 and all
@Nullable
annotations. These didn't add much value. and increased the binary size slightly. - Dropped Gson from
tracewriter
dependencies.
Behavior Changes
- Package info now includes Specification version (#199)
- Minor performance improvements avoiding loading some classes.
Release 0.26.0
API Changes
PerfMark.setEnabled()
now returns if setting the value succeeded. (#181).
Implementation Improvements
- Added work arounds for Java 19's Virtual threads, which may not be able to
use Thread Local storage. If this is the case, PerfMark attempts to
emulate thread local trace buffers using a concurrent map. - Trace storage now more eagerly removes storage when it find the thread
is gone, and is more GC friendly. PerfMark still attempts to preserve
trace data after a thread finishes, but without strongly referring to it.
Unstable API Changes
The following changes are to unstable APIs of PerfMark. This section
describes APIs for advanced users to try out new functionality before
it becomes API stable.
- Added Methods to
Storage
for clearing thread local and global storage (#177)Storage.clearLocalStorage()
enables individual threads to clear their storageStorage.clearGlobalIndex()
marks storage as SoftlyReachable where possible
It can be used to indiciate that future calls toStorage.read()
should not
include data after the point that the global index was cleared. Both
clearLocalStorage
andclearGlobalIndex
can be used to remove old trace
data.LocalMarkHolder
was added to enter and exit critical sections of of
MarkHolder mutation. The only implementation currently pulls the MarkHolder
out of thread local storage for editing. However, this designed to work with
other context-specific storage mechanisms, such as Kotlin's Coroutines.
Release 0.25.0
New Features
- Added an experimental JDK15 MarkHolder backend. This MarkHolder uses
hidden classes
which allows creating classes at runtime with custom storage sizes, without giving up constant propagation in the compiler. The trade off is additional memory per thread for the additional class structure. This can be tested by setting a system property (e.g.-Dio.perfmark.PerfMark.markHolderProvider=io.perfmark.java15.SecretHiddenClassMarkHolderProvider.HiddenClassMarkHolderProvider
) ( 5fa4adf )
General Improvements
- PerfMark disables itself safely now in the event of a strict Security Manager. (tests: 45de84d)
- Debug logging was modified to use reflection, to avoid accidentally loading classes, even if
io.perfmark.Perfmark.debug
was set to false.
This also avoid accidentally requiring thejava.logging
module (4f87fb7, 957986d)
Breaking Changes
- The Automatic Module Name for
java6
,java7
jars were changed tojavasix
andjavaseven
respectively. Auto module naming has trouble working with packages that end in numbers, as it conflicts with the version detection.javanine
was already set correctly.
Release v0.24.0
New Features
- Added an examples subproject which shows how to serve the TraceUI over the web. This uses Perfetto which can help in reducing the large jar size that the
traceviewer
subproject uses. ( c1f3f63 ) TaskCloseable
is now stabilized ( ac72491 )- Added JPMS Support (Java 9 Modules) via
Automatic-Module-Name
( 6a91457 )
Behavior Changes
Class Loading
- Avoid using
java.util.Logger
if possible. This reduces the class load time (18ms -> 9ms) and memory usage. ( be6ddaf , cf43b05 ) - Logging can be re-enabled by setting the system property
io.perfmark.Perfmark.debug=true
, which is useful for diagnosing failures to load. - Only a single implementation of
Generator
andMarkHolderProvider
are loaded, rather than loading all available implementations. - PerfMark is more cautious about failing during static initialization. It now safely disables itself if any problems are encountered.
Memory Usage
-
PerfMark keeps all trace info in a thread-local buffer, with the expectation that the data would be read asynchronously. Because it was
not clear if/when the data would read later, the life time of the trace data was limitted to the lifetime of the thread. When the
thread exited, the next call to read the trace data would consume and delete it. Since it was still unclear how often this would be
consumed, every new thread created would also delete the data of any other dead threads.This has been changed to keep the trace data around (but not the thread) for as long as there is available memory (via a SoftReference).
If a thread is dead, and a major GC cycle happens, the trace data will be cleared. This also means that for applications which do not
have major GC's frequently, the memory usage will appear to be higher. The purpose of this change is to ensure the trace data for
recently deceased threads can be consumed, rather than it being removed before it could be read. ( b6d650f )
Documentation
- Improved the documentation in several places, describing key concepts in the Javadocs ( 4ea4529 , e248396)
Bug Fixes
Release v0.23.0
API Changes
- Added
TaskCloseable
which allows using try-with-resources blocks with PerfMark.
Bug Fixes
- Fixed a bug that caused all tasks to have the same color on the Chrome Trace viewer.
Release v0.22.0
API Changes
- New
attachTag()
overload that accepts a lambda. This allows delaying the tag value if PerfMark is disabled - New
startTask()
overload that accepts a lambda. This allows delaying the name if PerfMark is disabled stopTask(void)
which doesn't need to matched up with a start task call.
Starting with this release, it is no longer strongly recommended that start/stop task have matching arguments. It may still be used in the case of code clarity or some other rare cases, but is not required. See the rationale for more info.
Release v0.21.0
Changes
- Updated the TraceViewer to work with Chrome version 80 and above.
Release v0.20.1
Bug Fixes
- Fixed a bug where Events without tags were not treated by the trace writer
- Fixed a bug where Base64 encoding of the TraceViewer can't be parsed by the browser
Release 0.20.0
Changes
- PerfMark task starts, stops, and events can now accept a "sub" task, as a second parameter. This makes it possible to avoid doing String concatenation when PerfMark is disabled
- Expose named tagging methods, also overloaded as
attachTag
. These tags are different fromTag
as they have a name associated with the value. - Add two-long tag variant, to accept 128 bit tag values. In the future, 128bit tags can be used for UUIDs, IPv6 addresses, and other larger tag spaces.
Release 0.19.0
Changes:
- Removed
@CompileTimeConstant
from PerfMark, and instead relaxed to just being a runtime constant. - Fixed bug where the start time of recording only was calculated after being enabled
- Made trace writer unconditionally flush after writing HTML.