Atavism Version 2018.1AGIS API

atavism.server.util
Class MeterManager

java.lang.Object
  extended by atavism.server.util.MeterManager

public class MeterManager
extends java.lang.Object

The MeterManager creates and hands out TimingMeter instances. Those instances are looked up by meter "title", a string name for the meter. Meter instances also have a string "category", so you can turn metering on and off by category. All public methods of MeterManager are static, so the user doesn't have to worry about managing the instance of MeterManager.

The workflow is that the user program creates several meters by calling the static MakeMeter method, passing the title and category of the meter. That method looks up the meter by title, creating it if it doesn't already exists, and returns the meter. Thereafter, the user invokes the TimingMeter.Enter() and TimingMeter.Exit() methods, each of which causes the MeterManager to add a record to a collection of entries and exits. The record has the identity of the meter; whether it's an entry or exit, and the time in processor ticks, captured using the assembler primitive RDTSC. At any point, the program can call the method Report(), which produces a report based on the trace.


Nested Class Summary
protected static class MeterManager.MeterEvent
           
protected static class MeterManager.MeterStackEntry
           
 
Field Summary
static boolean Collecting
           
static int DontDisplayUsecs
           
protected static boolean dumpEventLog
           
static short ekEnter
           
static short ekExit
           
protected  java.util.Vector<MeterManager.MeterEvent> eventTrace
           
protected static MeterManager instance
           
protected  java.util.HashMap<java.lang.Short,TimingMeter> metersById
           
protected  java.util.HashMap<java.lang.String,TimingMeter> metersByTitle
           
protected  long startTime
           
protected  short timerIdCounter
           
 
Constructor Summary
protected MeterManager()
           
 
Method Summary
static int AddEvent(TimingMeter meter, short eventKind)
           
protected static void BarfOnBadChars(java.lang.String name, java.lang.String nameDescription)
           
protected  boolean BooleanOption(java.lang.String name, java.util.HashMap<java.lang.String,java.lang.String> options)
           
protected static long CaptureCurrentTime()
           
static void ClearEvents()
           
static void DumpEventLog()
           
protected  void DumpEventLogInternal()
           
static void EnableCategory(java.lang.String categoryName, boolean enable)
           
protected  void GenerateReport(java.io.FileWriter writer, int start, java.util.HashMap<java.lang.String,java.lang.String> options)
           
static TimingMeter GetMeter(java.lang.String title, java.lang.String category)
           
static TimingMeter GetMeter(java.lang.String title, java.lang.String category, boolean accumulate)
           
protected  TimingMeter GetMeterById(int id)
           
protected  java.lang.String IndentCount(int count)
           
static void Init()
           
protected  int IntOption(java.lang.String name, java.util.HashMap<java.lang.String,java.lang.String> options)
           
protected  java.lang.String OptionValue(java.lang.String name, java.util.HashMap<java.lang.String,java.lang.String> options)
           
static void Report(java.lang.String title)
           
static void Report(java.lang.String title, java.io.FileWriter writer, int start, java.lang.String optionsString)
           
static void SaveToFile(java.lang.String pathname)
           
protected  void SaveToFileInternal(java.lang.String pathname)
           
static long StartTime()
           
protected  long ToMicroseconds(long ticks)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected static MeterManager instance

timerIdCounter

protected short timerIdCounter

startTime

protected long startTime

eventTrace

protected java.util.Vector<MeterManager.MeterEvent> eventTrace

metersByTitle

protected java.util.HashMap<java.lang.String,TimingMeter> metersByTitle

metersById

protected java.util.HashMap<java.lang.Short,TimingMeter> metersById

dumpEventLog

protected static boolean dumpEventLog

Collecting

public static boolean Collecting

DontDisplayUsecs

public static int DontDisplayUsecs

ekEnter

public static short ekEnter

ekExit

public static short ekExit
Constructor Detail

MeterManager

protected MeterManager()
Method Detail

CaptureCurrentTime

protected static long CaptureCurrentTime()

OptionValue

protected java.lang.String OptionValue(java.lang.String name,
                                       java.util.HashMap<java.lang.String,java.lang.String> options)

BooleanOption

protected boolean BooleanOption(java.lang.String name,
                                java.util.HashMap<java.lang.String,java.lang.String> options)

IntOption

protected int IntOption(java.lang.String name,
                        java.util.HashMap<java.lang.String,java.lang.String> options)

BarfOnBadChars

protected static void BarfOnBadChars(java.lang.String name,
                                     java.lang.String nameDescription)
                              throws java.lang.Exception
Throws:
java.lang.Exception

GetMeterById

protected TimingMeter GetMeterById(int id)

SaveToFileInternal

protected void SaveToFileInternal(java.lang.String pathname)

IndentCount

protected java.lang.String IndentCount(int count)

ToMicroseconds

protected long ToMicroseconds(long ticks)

DumpEventLogInternal

protected void DumpEventLogInternal()

GenerateReport

protected void GenerateReport(java.io.FileWriter writer,
                              int start,
                              java.util.HashMap<java.lang.String,java.lang.String> options)

Init

public static void Init()

EnableCategory

public static void EnableCategory(java.lang.String categoryName,
                                  boolean enable)

GetMeter

public static TimingMeter GetMeter(java.lang.String title,
                                   java.lang.String category)

GetMeter

public static TimingMeter GetMeter(java.lang.String title,
                                   java.lang.String category,
                                   boolean accumulate)

AddEvent

public static int AddEvent(TimingMeter meter,
                           short eventKind)

ClearEvents

public static void ClearEvents()

SaveToFile

public static void SaveToFile(java.lang.String pathname)

StartTime

public static long StartTime()

Report

public static void Report(java.lang.String title)

Report

public static void Report(java.lang.String title,
                          java.io.FileWriter writer,
                          int start,
                          java.lang.String optionsString)

DumpEventLog

public static void DumpEventLog()


Copyright © 2018 Dragonsan Studios Sp. z o.o.