3 * Support for cooperative creation of unmanaged state dumps
6 * Alexander Kyte (alkyte@microsoft.com)
8 * (C) 2018 Microsoft, Inc.
11 #ifndef __MONO_UTILS_NATIVE_STATE__
12 #define __MONO_UTILS_NATIVE_STATE__
14 #ifndef DISABLE_CRASH_REPORTING
16 #include <mono/utils/mono-publib.h>
17 #include <mono/utils/mono-context.h>
18 #include <mono/metadata/threads-types.h>
19 #include <mono/utils/json.h>
21 #define MONO_NATIVE_STATE_PROTOCOL_VERSION "0.0.2"
26 MonoSummarySuspendHandshake
= 2,
27 MonoSummaryDumpTraversal
= 3,
28 MonoSummaryStateWriter
= 4,
29 MonoSummaryMerpWriter
= 5,
30 MonoSummaryMerpInvoke
= 6,
31 MonoSummaryCleanup
= 7,
34 MonoSummaryDoubleFault
= 9
46 mono_summarize_set_timeline_dir (const char *directory
);
49 mono_summarize_timeline_start (void);
52 mono_summarize_timeline_phase_log (MonoSummaryStage stage
);
55 mono_summarize_double_fault_log (void);
58 mono_summarize_timeline_read_level (const char *directory
, gboolean clear
);
63 * These use static memory, can only be called once
67 mono_summarize_native_state_begin (char *mem
, int size
);
70 mono_summarize_native_state_end (void);
73 mono_summarize_native_state_add_thread (MonoThreadSummary
*thread
, MonoContext
*ctx
, gboolean crashing_thread
);
76 * These use memory from the caller
79 mono_state_writer_init (MonoStateWriter
*writer
, gchar
*output_str
, int len
);
82 mono_native_state_init (MonoStateWriter
*writer
);
85 mono_native_state_emit (MonoStateWriter
*writer
);
88 mono_native_state_free (MonoStateWriter
*writer
, gboolean free_data
);
91 mono_native_state_add_thread (MonoStateWriter
*writer
, MonoThreadSummary
*thread
, MonoContext
*ctx
, gboolean first_thread
, gboolean crashing_thread
);
94 mono_crash_dump (const char *jsonFile
, MonoStackHash
*hashes
);
96 #endif // DISABLE_CRASH_REPORTING
98 #endif // MONO_UTILS_NATIVE_STATE