Nebula
Loading...
Searching...
No Matches
memoryprofile.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
25//------------------------------------------------------------------------------
26#include "foundation/stdneb.h"
27#include "ids/id.h"
28#include "assemblyid.h"
29
30namespace Scripting
31{
32
33class NSharpServer;
34
35//------------------------------------------------------------------------------
39{
40public:
42 static const IndexT NumGenerations = 5;
43
45 struct Sample
46 {
47 int64_t totalAllocated; // bytes allocated since the runtime started
48 int64_t heapSize; // heap size as the last collection reported it
49 int64_t fragmented; // fragmentation as the last collection reported it
50 int64_t memoryLoad; // physical memory load
51 int64_t memoryThreshold; // the memory the runtime has available, which is the bar budget
52 int64_t genSize[5]; // each generation's size after the last collection
53 int64_t genFrag[5]; // each generation's fragmentation after the last collection
54 double pauseTimePercentage; // the running pause time percentage
55 double totalPauseMs; // the pause time since the runtime started
58
59 int32_t genCollections[5]; // collections per generation since the runtime started
61 int32_t compacted;
62 int32_t concurrent;
63 int32_t pauseCount; // the pauses the last collection took
64 int32_t maxPauseMs; // the longest of those
65 };
66
68 static void Register(Scripting::NSharpServer* server, Scripting::AssemblyId assemblyId);
69
71 static void Clear();
72
74 static bool IsRegistered();
75
77 static bool Read(Sample& out);
78
80 static void Collect();
81
82private:
83 static void* readSample;
84 static void* collect;
85};
86
87} // namespace Scripting
88//------------------------------------------------------------------------------
The managed runtime's memory state, as this side can read it.
Definition memoryprofile.h:39
static void * readSample
Definition memoryprofile.h:83
static const IndexT NumGenerations
the generations the runtime reports. The last two are the large and the pinned object heaps
Definition memoryprofile.h:42
static void Register(Scripting::NSharpServer *server, Scripting::AssemblyId assemblyId)
resolve the managed entry points. Called by the feature unit at activation
Definition memoryprofile.cc:32
static void Clear()
drop the resolved entry points. The server closes, and the pointers go stale with it
Definition memoryprofile.cc:49
static bool IsRegistered()
true when the runtime is loaded and the entry point was found
Definition memoryprofile.cc:59
static void Collect()
run a full collection on the managed heap
Definition memoryprofile.cc:84
static bool Read(Sample &out)
read the runtime's memory state. Returns false when there is nothing to read
Definition memoryprofile.cc:70
static void * collect
Definition memoryprofile.h:84
C# backend for the Nebula scripting subsystem.
Definition nsharpserver.h:31
Definition game.cc:16
Definition assemblyid.h:12
one read of the managed heap. The values are the runtime's own, not this side's
Definition memoryprofile.h:46
int64_t genFrag[5]
Definition memoryprofile.h:53
double totalPauseMs
Definition memoryprofile.h:55
int32_t pauseCount
Definition memoryprofile.h:63
double pauseTimePercentage
Definition memoryprofile.h:54
int64_t totalAllocated
Definition memoryprofile.h:47
int64_t finalizationPending
Definition memoryprofile.h:57
int32_t genCollections[5]
Definition memoryprofile.h:59
int64_t memoryLoad
Definition memoryprofile.h:50
int64_t fragmented
Definition memoryprofile.h:49
int32_t concurrent
Definition memoryprofile.h:62
int32_t lastCollectedGeneration
Definition memoryprofile.h:60
int32_t compacted
Definition memoryprofile.h:61
int32_t maxPauseMs
Definition memoryprofile.h:64
int64_t heapSize
Definition memoryprofile.h:48
int64_t pinnedObjects
Definition memoryprofile.h:56
int64_t memoryThreshold
Definition memoryprofile.h:51
int64_t genSize[5]
Definition memoryprofile.h:52
int IndexT
Definition types.h:49