Contents
Class ClazzStatistic
java.lang.Object
java.lang.Thread
clazzfish.monitor.util.Shutdowner
clazzfish.monitor.stat.ClazzStatistic
- All Implemented Interfaces:
ClazzStatisticMBean
,Shutdownable
,Runnable
The ClazzStatistic collects classes and resources to find classes which are
likely to be dead. At the end a little statistics is reported to a file
'clazzfish/a.b.MyMain/ClazzStatistic.csv' in the temp directory.
If you want another directory or filename where this statistics should be
stored you can use one of the system properties
- clazzfish.dump.dir
- clazzfish.statistics.file
As alternative you can set one of the two environment variables:
- CLAZZFISH_STATISTICS_DIR
- CLAZZFISH_STATISTICS_FILE
NOTE: If a system property like 'appname' is set which looks like a program name this property is used instead of the Main classname.
- Since:
- 2.3 (25.11.24)
- Author:
- oboehm
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Method Summary
Modifier and TypeMethodDescriptionExports the statistics of the collected classes to the default location.Exports the statistics of the collected classes to the file with the given filename.Returns the URI where the statistic should be exported to.static ClazzStatistic
void
Deprecated, for removal: This API element is subject to removal in a future version.void
Importes the statistics form the given filename or URI.void
Imports the statistics from the given URI.void
logMe()
Prints the statistic as CSV to the log output.void
void
run()
toString()
Methods inherited from class clazzfish.monitor.util.Shutdowner
addMeAsShutdownHook, isShutdownHook, removeMeAsShutdownHook
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, yield
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface clazzfish.monitor.util.Shutdownable
addMeAsShutdownHook, isShutdownHook, removeMeAsShutdownHook
-
Method Details
-
getInstance
-
registerMeAsMBean
public void registerMeAsMBean() -
getAllClasses
-
getStatistics
-
getClasspathes
-
logMe
public void logMe()Prints the statistic as CSV to the log output.- Specified by:
logMe
in interfaceClazzStatisticMBean
-
getExportURI
Description copied from interface:ClazzStatisticMBean
Returns the URI where the statistic should be exported to.- Specified by:
getExportURI
in interfaceClazzStatisticMBean
- Returns:
- export URI
-
exportCSV
Description copied from interface:ClazzStatisticMBean
Exports the statistics of the collected classes to the default location.- Specified by:
exportCSV
in interfaceClazzStatisticMBean
- Returns:
- export file
- Throws:
IOException
- in case of I/O problems
-
exportCSV
Description copied from interface:ClazzStatisticMBean
Exports the statistics of the collected classes to the file with the given filename.- Specified by:
exportCSV
in interfaceClazzStatisticMBean
- Parameters:
filename
- filename or URI, where the statistics should be exported to- Returns:
- export URI
- Throws:
IOException
- in case of I/O problems
-
exportCSV
- Throws:
IOException
-
exportCSV
- Throws:
IOException
-
importCSV
Importes the statistics form the given filename or URI.- Specified by:
importCSV
in interfaceClazzStatisticMBean
- Parameters:
filename
- filename or URI- Since:
- 2.7
-
importCSV
Deprecated, for removal: This API element is subject to removal in a future version.useimportCSV(URI)
with csvFile.toURI() as parameterImportes the statistics form the given file.- Parameters:
csvFile
- import file
-
importCSV
Imports the statistics from the given URI. With issue #26 an internalMap
is now used to find aClazzRecord
. The speeds up the import by a factor of 5:- import of 10,000 lines: 130 - 150 ms (old), 20 - 30 ms (now)
- import of 60,000 lines: 200 - 230 ms (old), 50 - 80 ms (now)
- Parameters:
csvURI
- URI where the statistic should be imported from
-
run
-
toString
-
importCSV(URI)
with csvFile.toURI() as parameter