summaryrefslogtreecommitdiff
path: root/Runtime/Mono/MonoHeapShotWriter.h
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Mono/MonoHeapShotWriter.h')
-rw-r--r--Runtime/Mono/MonoHeapShotWriter.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/Runtime/Mono/MonoHeapShotWriter.h b/Runtime/Mono/MonoHeapShotWriter.h
new file mode 100644
index 0000000..0e86996
--- /dev/null
+++ b/Runtime/Mono/MonoHeapShotWriter.h
@@ -0,0 +1,64 @@
+#ifndef MONOHEAPSHOTWRITER_H
+#define MONOHEAPSHOTWRITER_H
+
+#include "Runtime/Mono/MonoTypes.h"
+#include "Runtime/Scripting/ScriptingUtility.h"
+#include "MonoHeapShot.h"
+
+#if ENABLE_MONO_HEAPSHOT
+
+
+class MonoHeapShotWriter
+{
+public:
+ MonoHeapShotWriter();
+ ~MonoHeapShotWriter();
+
+ void Start(HeapShotData* data);
+
+ void End();
+
+ void DumpObjectsReferencedByUnity();
+
+ void BeginObjectDump(MonoObject* obj, MonoClass* klass);
+
+ void EndObjectDump();
+
+ void DumpReference(gpointer ref, gpointer field);
+
+ inline const UInt8* GetData() const
+ {
+ return &(*m_Data)[0];
+ }
+ inline UInt32 GetDataSize() const
+ {
+ return m_Data->size();
+ }
+
+private:
+ void WriteByte (UInt8 x);
+
+ void WritePointer (void* x);
+
+ void WriteInt32 (SInt32 x);
+
+ void WriteUInt32 (UInt32 x);
+
+ void WriteVInt (UInt32 x);
+
+ void WriteString (const char *str);
+
+ typedef std::vector<UInt8> Data;
+ HeapShotData* m_Data;
+ ClassHash* m_SeenItems;
+ int m_TypeCount;
+ int m_ObjecCount;
+ int m_ReferenceCount;
+ int m_FieldCount;
+ long m_SavedOutfileOffset;
+};
+
+#endif
+
+#endif
+