Space Engineers
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | List of all members
VRage.Profiler.MyRenderProfiler Class Referenceabstract

Provides profiling capability More...

Inheritance diagram for VRage.Profiler.MyRenderProfiler:
VRageRender.Profiler.MyNullRenderProfiler VRageRender.Profiler.MyRenderProfilerRendering

Public Member Functions

void GetAutocommit (ref bool val)
 
void SetAutocommit (bool val)
 
void Commit ([CallerMemberName] string member="", [CallerLineNumber] int line=0, [CallerFilePath] string file="")
 
void Draw ([CallerMemberName] string member="", [CallerLineNumber] int line=0, [CallerFilePath] string file="")
 
void StartProfilingBlock (string blockName=null, float customValue=0, [CallerMemberName] string member="", [CallerLineNumber] int line=0, [CallerFilePath] string file="")
 
void EndProfilingBlock (float customValue=0, MyTimeSpan?customTime=null, string timeFormat=null, string valueFormat=null, [CallerMemberName] string member="", [CallerLineNumber] int line=0, [CallerFilePath] string file="")
 
void GPU_StartProfilingBlock (string blockName=null, float customValue=0, [CallerMemberName] string member="", [CallerLineNumber] int line=0, [CallerFilePath] string file="")
 
void GPU_EndProfilingBlock (float customValue=0, MyTimeSpan?customTime=null, string timeFormat=null, string valueFormat=null, [CallerMemberName] string member="", [CallerLineNumber] int line=0, [CallerFilePath] string file="")
 
void StartNextBlock (string name, [CallerMemberName] string member="", [CallerLineNumber] int line=0, [CallerFilePath] string file="")
 
void InitMemoryHack (string name)
 
void ProfileCustomValue (string name, float value, MyTimeSpan?customTime=null, string timeFormat=null, string valueFormat=null, [CallerMemberName] string member="", [CallerLineNumber] int line=0, [CallerFilePath] string file="")
 
void SetLevel (int index)
 
void Dump ()
 

Static Public Member Functions

static MyProfiler CreateProfiler (string name, string axisName=null, bool memoryProfiling=false)
 Creates new profiler which can be used to profile anything (e.g. network stats). More...
 
static List< MyProfilerBlockGetSortedChildren (int frameToSortBy)
 
static MyProfilerBlock FindBlockByIndex (int index)
 
static MyProfilerBlock FindBlockByMax (int frameIndex, int lastValidFrame)
 
static void HandleInput (RenderProfilerCommand command, int index)
 
static MyProfiler GetProfilerAtIndex (int index)
 

Public Attributes

const string PerformanceProfilingSymbol = VRage.MyCompilationSymbols.PerformanceProfiling ? "WINDOWS" : "__RANDOM_UNDEFINED_PROFILING_SYMBOL__"
 
const bool MemoryProfiling = VRage.MyCompilationSymbols.ProfileWorkingSetMemory
 

Static Public Attributes

static bool Paused = false
 
static Action< int > GetProfilerFromServer
 
static Action< int > SaveProfilerToFile
 
static Action< int > LoadProfilerFromFile
 
static int ServerSelectedIndex
 
static bool IsProfilerFromServer
 

Protected Member Functions

abstract void Draw (MyProfiler drawProfiler, int lastFrameIndex, int frameToDraw)
 

Static Protected Member Functions

static Color IndexToColor (int index)
 
static bool IsValidIndex (int frameIndex, int lastValidFrame)
 
static float FindMaxWrap (float[] data, int lower, int upper, int lastValidFrame, out int maxIndex)
 

Protected Attributes

StringBuilder m_text = new StringBuilder(100)
 

Static Protected Attributes

static RenderProfilerSortingOrder m_sortingOrder = RenderProfilerSortingOrder.MillisecondsLastFrame
 Sorting order will sort the listed elements in the profiler by the specified ProfilerSortingOrder More...
 
static MyDrawArea m_milisecondsGraphScale = new MyDrawArea(0.49f, 0, (2 - 0.51f) / 2, 0.9f, 25)
 
static MyDrawArea m_memoryGraphScale = new MyDrawArea(0.49f, 0, (2 - 0.51f) / 2, 0.6f, 0.001f)
 
static Color[] m_colors
 
static MyProfilerBlock m_fpsBlock
 
static float m_fpsPctg
 
static List< MyProfilerm_threadProfilers = new List<MyProfiler>(16)
 
static MyProfiler m_selectedProfiler
 
static bool m_enabled = false
 
static int m_selectedFrame = 0
 
static int m_levelLimit = -1
 
static bool m_useCustomFrame = false
 
static int m_frameLocalArea = MyProfiler.MAX_FRAMES
 

Properties

static bool ProfilerProcessingEnabled [get]
 
static bool ProfilerVisible [get]
 Returns true when profiler is visible. More...
 
static MyProfiler SelectedProfiler [get, set]
 
static int SelectedIndex [get]
 

Detailed Description

Provides profiling capability

Non-locking way of render profiler is used. Each thread has it's own profiler is ThreadStatic variable. Data for each profiling block are of two kinds: Immediate (current frame being profiled) and History (previous finished frames) Start/End locking is not necessary, because Start/Stop uses only immediate data and nothing else uses it at the moment. Commit is only other place which uses Immediate data, but it must be called from same thead, no racing condition. Draw and Commit both uses History data, and both can be called from different thread, so there's lock. This way everything runs with no waiting, unless Draw obtains lock in which case Commit wait for Draw to finish (Start/End is still exact).

For threads which does not call commit (background workers, parallel tasks), mechanism which calls commit automatically after each top level End should be added. This way each task will be one "frame" on display

Definition at line 122 of file MyRenderProfiler.cs.

Member Function Documentation

void VRage.Profiler.MyRenderProfiler.Commit ( [CallerMemberName] string  member = "",
[CallerLineNumber] int  line = 0,
[CallerFilePath] string  file = "" 
)
inline

Definition at line 701 of file MyRenderProfiler.cs.

static MyProfiler VRage.Profiler.MyRenderProfiler.CreateProfiler ( string  name,
string  axisName = null,
bool  memoryProfiling = false 
)
inlinestatic

Creates new profiler which can be used to profile anything (e.g. network stats).

Definition at line 241 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.Draw ( [CallerMemberName] string  member = "",
[CallerLineNumber] int  line = 0,
[CallerFilePath] string  file = "" 
)
inline

Definition at line 717 of file MyRenderProfiler.cs.

abstract void VRage.Profiler.MyRenderProfiler.Draw ( MyProfiler  drawProfiler,
int  lastFrameIndex,
int  frameToDraw 
)
protectedpure virtual
void VRage.Profiler.MyRenderProfiler.Dump ( )
inline

Definition at line 806 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.EndProfilingBlock ( float  customValue = 0,
MyTimeSpan customTime = null,
string  timeFormat = null,
string  valueFormat = null,
[CallerMemberName] string  member = "",
[CallerLineNumber] int  line = 0,
[CallerFilePath] string  file = "" 
)
inline

Definition at line 748 of file MyRenderProfiler.cs.

static MyProfilerBlock VRage.Profiler.MyRenderProfiler.FindBlockByIndex ( int  index)
inlinestatic

Definition at line 290 of file MyRenderProfiler.cs.

static MyProfilerBlock VRage.Profiler.MyRenderProfiler.FindBlockByMax ( int  frameIndex,
int  lastValidFrame 
)
inlinestatic

Definition at line 309 of file MyRenderProfiler.cs.

static float VRage.Profiler.MyRenderProfiler.FindMaxWrap ( float[]  data,
int  lower,
int  upper,
int  lastValidFrame,
out int  maxIndex 
)
inlinestaticprotected

Definition at line 671 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.GetAutocommit ( ref bool  val)
inline

Definition at line 691 of file MyRenderProfiler.cs.

static MyProfiler VRage.Profiler.MyRenderProfiler.GetProfilerAtIndex ( int  index)
inlinestatic

Definition at line 832 of file MyRenderProfiler.cs.

static List<MyProfilerBlock> VRage.Profiler.MyRenderProfiler.GetSortedChildren ( int  frameToSortBy)
inlinestatic

Definition at line 255 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.GPU_EndProfilingBlock ( float  customValue = 0,
MyTimeSpan customTime = null,
string  timeFormat = null,
string  valueFormat = null,
[CallerMemberName] string  member = "",
[CallerLineNumber] int  line = 0,
[CallerFilePath] string  file = "" 
)
inline

Definition at line 760 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.GPU_StartProfilingBlock ( string  blockName = null,
float  customValue = 0,
[CallerMemberName] string  member = "",
[CallerLineNumber] int  line = 0,
[CallerFilePath] string  file = "" 
)
inline

Definition at line 754 of file MyRenderProfiler.cs.

static void VRage.Profiler.MyRenderProfiler.HandleInput ( RenderProfilerCommand  command,
int  index 
)
inlinestatic

Definition at line 331 of file MyRenderProfiler.cs.

static Color VRage.Profiler.MyRenderProfiler.IndexToColor ( int  index)
inlinestaticprotected

Definition at line 154 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.InitMemoryHack ( string  name)
inline

Definition at line 773 of file MyRenderProfiler.cs.

static bool VRage.Profiler.MyRenderProfiler.IsValidIndex ( int  frameIndex,
int  lastValidFrame 
)
inlinestaticprotected

Definition at line 302 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.ProfileCustomValue ( string  name,
float  value,
MyTimeSpan customTime = null,
string  timeFormat = null,
string  valueFormat = null,
[CallerMemberName] string  member = "",
[CallerLineNumber] int  line = 0,
[CallerFilePath] string  file = "" 
)
inline

Definition at line 779 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.SetAutocommit ( bool  val)
inline

Definition at line 696 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.SetLevel ( int  index)
inline

Definition at line 798 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.StartNextBlock ( string  name,
[CallerMemberName] string  member = "",
[CallerLineNumber] int  line = 0,
[CallerFilePath] string  file = "" 
)
inline

Definition at line 767 of file MyRenderProfiler.cs.

void VRage.Profiler.MyRenderProfiler.StartProfilingBlock ( string  blockName = null,
float  customValue = 0,
[CallerMemberName] string  member = "",
[CallerLineNumber] int  line = 0,
[CallerFilePath] string  file = "" 
)
inline

Definition at line 742 of file MyRenderProfiler.cs.

Member Data Documentation

Action<int> VRage.Profiler.MyRenderProfiler.GetProfilerFromServer
static

Definition at line 174 of file MyRenderProfiler.cs.

bool VRage.Profiler.MyRenderProfiler.IsProfilerFromServer
static

Definition at line 229 of file MyRenderProfiler.cs.

Action<int> VRage.Profiler.MyRenderProfiler.LoadProfilerFromFile
static

Definition at line 176 of file MyRenderProfiler.cs.

Color [] VRage.Profiler.MyRenderProfiler.m_colors
staticprotected
Initial value:
= { new Color(0,192,192), Color.Orange, Color.BlueViolet * 1.5f, Color.BurlyWood, Color.Chartreuse,
Color.CornflowerBlue, Color.Cyan, Color.ForestGreen, Color.Fuchsia,
Color.Gold, Color.GreenYellow, Color.LightBlue, Color.LightGreen, Color.LimeGreen,
Color.Magenta, Color.MintCream, Color.Orchid, Color.PeachPuff, Color.Purple }

Definition at line 149 of file MyRenderProfiler.cs.

bool VRage.Profiler.MyRenderProfiler.m_enabled = false
staticprotected

Definition at line 221 of file MyRenderProfiler.cs.

MyProfilerBlock VRage.Profiler.MyRenderProfiler.m_fpsBlock
staticprotected

Definition at line 164 of file MyRenderProfiler.cs.

float VRage.Profiler.MyRenderProfiler.m_fpsPctg
staticprotected

Definition at line 165 of file MyRenderProfiler.cs.

int VRage.Profiler.MyRenderProfiler.m_frameLocalArea = MyProfiler.MAX_FRAMES
staticprotected

Definition at line 225 of file MyRenderProfiler.cs.

int VRage.Profiler.MyRenderProfiler.m_levelLimit = -1
staticprotected

Definition at line 223 of file MyRenderProfiler.cs.

MyDrawArea VRage.Profiler.MyRenderProfiler.m_memoryGraphScale = new MyDrawArea(0.49f, 0, (2 - 0.51f) / 2, 0.6f, 0.001f)
staticprotected

Definition at line 147 of file MyRenderProfiler.cs.

MyDrawArea VRage.Profiler.MyRenderProfiler.m_milisecondsGraphScale = new MyDrawArea(0.49f, 0, (2 - 0.51f) / 2, 0.9f, 25)
staticprotected

Definition at line 146 of file MyRenderProfiler.cs.

int VRage.Profiler.MyRenderProfiler.m_selectedFrame = 0
staticprotected

Definition at line 222 of file MyRenderProfiler.cs.

MyProfiler VRage.Profiler.MyRenderProfiler.m_selectedProfiler
staticprotected

Definition at line 208 of file MyRenderProfiler.cs.

RenderProfilerSortingOrder VRage.Profiler.MyRenderProfiler.m_sortingOrder = RenderProfilerSortingOrder.MillisecondsLastFrame
staticprotected

Sorting order will sort the listed elements in the profiler by the specified ProfilerSortingOrder

Definition at line 127 of file MyRenderProfiler.cs.

StringBuilder VRage.Profiler.MyRenderProfiler.m_text = new StringBuilder(100)
protected

Definition at line 159 of file MyRenderProfiler.cs.

List<MyProfiler> VRage.Profiler.MyRenderProfiler.m_threadProfilers = new List<MyProfiler>(16)
staticprotected

Definition at line 206 of file MyRenderProfiler.cs.

bool VRage.Profiler.MyRenderProfiler.m_useCustomFrame = false
staticprotected

Definition at line 224 of file MyRenderProfiler.cs.

const bool VRage.Profiler.MyRenderProfiler.MemoryProfiling = VRage.MyCompilationSymbols.ProfileWorkingSetMemory

Definition at line 162 of file MyRenderProfiler.cs.

bool VRage.Profiler.MyRenderProfiler.Paused = false
static

Definition at line 172 of file MyRenderProfiler.cs.

const string VRage.Profiler.MyRenderProfiler.PerformanceProfilingSymbol = VRage.MyCompilationSymbols.PerformanceProfiling ? "WINDOWS" : "__RANDOM_UNDEFINED_PROFILING_SYMBOL__"

Definition at line 129 of file MyRenderProfiler.cs.

Action<int> VRage.Profiler.MyRenderProfiler.SaveProfilerToFile
static

Definition at line 175 of file MyRenderProfiler.cs.

int VRage.Profiler.MyRenderProfiler.ServerSelectedIndex
static

Definition at line 228 of file MyRenderProfiler.cs.

Property Documentation

bool VRage.Profiler.MyRenderProfiler.ProfilerProcessingEnabled
staticget

Definition at line 134 of file MyRenderProfiler.cs.

bool VRage.Profiler.MyRenderProfiler.ProfilerVisible
staticget

Returns true when profiler is visible.

Definition at line 142 of file MyRenderProfiler.cs.

int VRage.Profiler.MyRenderProfiler.SelectedIndex
staticget

Definition at line 217 of file MyRenderProfiler.cs.

MyProfiler VRage.Profiler.MyRenderProfiler.SelectedProfiler
staticgetset

Definition at line 211 of file MyRenderProfiler.cs.


The documentation for this class was generated from the following file: