Package org.apache.sysds.utils

## Class Statistics

- java.lang.Object
- - org.apache.sysds.utils.Statistics

    public class Statistics
    extends Object

This class captures all statistics.

### Nested Class Summary

Nested Classes
`static class` `Statistics.LineageNGramExtension`
`static class` `Statistics.NGramStats`

### Field Summary

Fields
`static long` `allocateDoubleArrTime`
`static boolean` `allowWorkerStatistics`
`static long` `examSparsityTime`
`static long` `recomputeNNZTime`

### Constructor Summary

Constructors
`Statistics()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `addCPMemObject​(int hash, double sizeof)`
`static void` `clearNGramRecording()`
`static void` `decrementNoOfExecutedSPInst()`
`static String` `display()` Returns statistics of the DML program that was recently completed as a string
`static String` `display​(int maxHeavyHitters)` Returns statistics as a string
`static void` `extendLineageItem​(LineageItem li, Statistics.LineageNGramExtension ext)`
`static String` `getCommonNGrams​(NGramBuilder<String,​Statistics.NGramStats> builder, int num)`
`static long` `getCompileTime()`
`static String` `getCPHeavyHitterCode​(Instruction inst)`
`static long` `getCPHeavyHitterCount​(String opcode)`
`static Set<String>` `getCPHeavyHitterOpCodes()`
`static String` `getCPHeavyHittersMem​(int num)`
`static Optional<Map.Entry<String,​LineageItem>>` `getCurrentLineageItem()`
`static Statistics.LineageNGramExtension` `getExtendedLineage​(LineageItem li)`
`static long` `getFunRecompiles()`
`static long` `getFunRecompileTime()`
`static String` `getHeavyHitters​(int num)` Obtain a string tabular representation of the heavy hitter instructions that displays the time, instruction count, and optionally GPU stats about each instruction.
`static HashMap<String,​org.apache.commons.lang3.tuple.Pair<Long,​Double>>` `getHeavyHittersHashMap()`
`static long` `getJITCompileTime()` Returns the total time of asynchronous JIT compilation in milliseconds.
`static long` `getJVMgcCount()`
`static long` `getJVMgcTime()`
`static String` `getNGramAvgTimes​(Statistics.NGramStats[] stats, int offset, int prec)`
`static String` `getNGramStdDevs​(Statistics.NGramStats[] stats, int offset, int prec, boolean displayZero)`
`static long` `getNoOfCompiledSPInst()`
`static long` `getNoOfExecutedSPInst()`
`static long` `getNumPinnedObjects()`
`static long` `getRunTime()` Returns the total time of run in nanoseconds.
`static double` `getSizeofPinnedObjects()`
`static long` `getTotalLix()`
`static long` `getTotalLixUIP()`
`static long` `getTotalUIPVar()`
`static void` `incrementFunRecompiles()`
`static void` `incrementFunRecompileTime​(long delta)`
`static void` `incrementJITCompileTime​(long time)`
`static void` `incrementJVMgcCount​(long delta)`
`static void` `incrementJVMgcTime​(long time)`
`static void` `incrementNoOfCompiledSPInst()`
`static void` `incrementNoOfExecutedSPInst()`
`static void` `incrementTotalLix()`
`static void` `incrementTotalLixUIP()`
`static void` `incrementTotalUIPVar()`
`static void` `maintainCPFuncCallStats​(String instName)`
`static void` `maintainCPHeavyHitters​(String instName, long timeNanos)` "Maintains" or adds time to per instruction/op timers, also increments associated count
`static void` `maintainCPHeavyHittersMem​(String name, double sizeof)` Helper method which keeps track of the heaviest weight objects (by total memory used) throughout execution of the program.
`static void` `maintainNGrams​(String instName, long timeNanos)`
`static void` `maintainNGramsFromLineage​(Instruction tmp, ExecutionContext ec, long t0)`
`static void` `maintainNGramsFromLineage​(LineageItem li)`
`static NGramBuilder<String,​Statistics.NGramStats>[]` `mergeNGrams()`
`static String` `nGramToCSV​(NGramBuilder<String,​Statistics.NGramStats> mbuilder)`
`static void` `prepareNGramInst​(Map.Entry<String,​LineageItem> li)`
`static void` `removeCPMemObject​(int hash)` Helper method to remove a memory object which has become unpinned
`static void` `reset()`
`static void` `resetCPHeavyHitters()`
`static void` `resetJITCompileTime()`
`static void` `resetJVMgcCount()`
`static void` `resetJVMgcTime()`
`static void` `resetNoOfCompiledJobs​(int count)`
`static void` `resetNoOfExecutedJobs()`
`static void` `startCompileTimer()`
`static void` `startRunTimer()` Starts the timer, should be invoked immediately before invoking Program.execute()
`static void` `stopCompileTimer()`
`static void` `stopRunTimer()` Stops the timer, should be invoked immediately after invoking Program.execute()
`static void` `toCSVStream​(NGramBuilder<String,​Statistics.NGramStats> mbuilder, Consumer<String> lineConsumer)`
`static String[]` `wrap​(String str, int wrapLength)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### recomputeNNZTime

    public static long recomputeNNZTime

#### examSparsityTime

    public static long examSparsityTime

#### allocateDoubleArrTime

    public static long allocateDoubleArrTime

#### allowWorkerStatistics

    public static boolean allowWorkerStatistics

### Constructor Detail

#### Statistics

    public Statistics()

### Method Detail

#### getNoOfExecutedSPInst

    public static long getNoOfExecutedSPInst()

#### incrementNoOfExecutedSPInst

    public static void incrementNoOfExecutedSPInst()

#### decrementNoOfExecutedSPInst

    public static void decrementNoOfExecutedSPInst()

#### getNoOfCompiledSPInst

    public static long getNoOfCompiledSPInst()

#### incrementNoOfCompiledSPInst

    public static void incrementNoOfCompiledSPInst()

#### getTotalUIPVar

    public static long getTotalUIPVar()

#### incrementTotalUIPVar

    public static void incrementTotalUIPVar()

#### getTotalLixUIP

    public static long getTotalLixUIP()

#### incrementTotalLixUIP

    public static void incrementTotalLixUIP()

#### getTotalLix

    public static long getTotalLix()

#### incrementTotalLix

    public static void incrementTotalLix()

#### resetNoOfCompiledJobs

    public static void resetNoOfCompiledJobs​(int count)

#### resetNoOfExecutedJobs

    public static void resetNoOfExecutedJobs()

#### incrementJITCompileTime

    public static void incrementJITCompileTime​(long time)

#### incrementJVMgcTime

    public static void incrementJVMgcTime​(long time)

#### incrementJVMgcCount

    public static void incrementJVMgcCount​(long delta)

#### incrementFunRecompileTime

    public static void incrementFunRecompileTime​(long delta)

#### incrementFunRecompiles

    public static void incrementFunRecompiles()

#### startCompileTimer

    public static void startCompileTimer()

#### stopCompileTimer

    public static void stopCompileTimer()

#### getCompileTime

    public static long getCompileTime()

#### startRunTimer

    public static void startRunTimer()

Starts the timer, should be invoked immediately before invoking Program.execute()

#### stopRunTimer

    public static void stopRunTimer()

Stops the timer, should be invoked immediately after invoking Program.execute()

#### getRunTime

    public static long getRunTime()

Returns the total time of run in nanoseconds.

Returns:
  run time in nanoseconds

#### reset

    public static void reset()

#### resetJITCompileTime

    public static void resetJITCompileTime()

#### resetJVMgcTime

    public static void resetJVMgcTime()

#### resetJVMgcCount

    public static void resetJVMgcCount()

#### resetCPHeavyHitters

    public static void resetCPHeavyHitters()

#### getCPHeavyHitterCode

    public static String getCPHeavyHitterCode​(Instruction inst)

#### addCPMemObject

    public static void addCPMemObject​(int hash,
                                      double sizeof)

#### removeCPMemObject

    public static void removeCPMemObject​(int hash)

Helper method to remove a memory object which has become unpinned

Parameters:
  `hash` - hash of data object

#### maintainCPHeavyHittersMem

    public static void maintainCPHeavyHittersMem​(String name,
                                                 double sizeof)

Helper method which keeps track of the heaviest weight objects (by total memory used) throughout execution of the program. Only reported if JMLC memory statistics are enabled and finegrained statistics are enabled. We only keep track of the -largest- instance of data associated with a particular string identifier so no need to worry about multiple bindings to the same name

Parameters:
  `name` - String denoting the variables name
  `sizeof` - objects size (estimated bytes)

#### maintainCPHeavyHitters

    public static void maintainCPHeavyHitters​(String instName,
                                              long timeNanos)

"Maintains" or adds time to per instruction/op timers, also increments associated count

Parameters:
  `instName` - name of the instruction/op
  `timeNanos` - time in nano seconds

#### prepareNGramInst

    public static void prepareNGramInst​(Map.Entry<String,​LineageItem> li)

#### getCurrentLineageItem

    public static Optional<Map.Entry<String,​LineageItem>> getCurrentLineageItem()

#### clearNGramRecording

    public static void clearNGramRecording()

#### extendLineageItem

    public static void extendLineageItem​(LineageItem li,
                                         Statistics.LineageNGramExtension ext)

#### getExtendedLineage

    public static Statistics.LineageNGramExtension getExtendedLineage​(LineageItem li)

#### maintainNGramsFromLineage

    public static void maintainNGramsFromLineage​(Instruction tmp,
                                                 ExecutionContext ec,
                                                 long t0)

#### maintainNGramsFromLineage

    public static void maintainNGramsFromLineage​(LineageItem li)

#### maintainNGrams

    public static void maintainNGrams​(String instName,
                                      long timeNanos)

#### mergeNGrams

    public static NGramBuilder<String,​Statistics.NGramStats>[] mergeNGrams()

#### getNGramStdDevs

    public static String getNGramStdDevs​(Statistics.NGramStats[] stats,
                                         int offset,
                                         int prec,
                                         boolean displayZero)

#### getNGramAvgTimes

    public static String getNGramAvgTimes​(Statistics.NGramStats[] stats,
                                          int offset,
                                          int prec)

#### toCSVStream

    public static void toCSVStream​(NGramBuilder<String,​Statistics.NGramStats> mbuilder,
                                   Consumer<String> lineConsumer)

#### nGramToCSV

    public static String nGramToCSV​(NGramBuilder<String,​Statistics.NGramStats> mbuilder)

#### getCommonNGrams

    public static String getCommonNGrams​(NGramBuilder<String,​Statistics.NGramStats> builder,
                                         int num)

#### maintainCPFuncCallStats

    public static void maintainCPFuncCallStats​(String instName)

#### getCPHeavyHitterOpCodes

    public static Set<String> getCPHeavyHitterOpCodes()

#### getCPHeavyHitterCount

    public static long getCPHeavyHitterCount​(String opcode)

#### getHeavyHittersHashMap

    public static HashMap<String,​org.apache.commons.lang3.tuple.Pair<Long,​Double>> getHeavyHittersHashMap()

#### getHeavyHitters

    public static String getHeavyHitters​(int num)

Obtain a string tabular representation of the heavy hitter instructions that displays the time, instruction count, and optionally GPU stats about each instruction.

Parameters:
  `num` - the maximum number of heavy hitters to display
Returns:
  string representing the heavy hitter instructions in tabular format

#### getCPHeavyHittersMem

    public static String getCPHeavyHittersMem​(int num)

#### getJITCompileTime

    public static long getJITCompileTime()

Returns the total time of asynchronous JIT compilation in milliseconds.

Returns:
  JIT compile time

#### getJVMgcTime

    public static long getJVMgcTime()

#### getJVMgcCount

    public static long getJVMgcCount()

#### getFunRecompileTime

    public static long getFunRecompileTime()

#### getFunRecompiles

    public static long getFunRecompiles()

#### getNumPinnedObjects

    public static long getNumPinnedObjects()

#### getSizeofPinnedObjects

    public static double getSizeofPinnedObjects()

#### display

    public static String display()

Returns statistics of the DML program that was recently completed as a string

Returns:
  statistics as a string

#### wrap

    public static String[] wrap​(String str,
                                int wrapLength)

#### display

    public static String display​(int maxHeavyHitters)

Returns statistics as a string

Parameters:
  `maxHeavyHitters` - The maximum number of heavy hitters that are printed
Returns:
  statistics as string