Add mono log profiler support
This commit is contained in:
parent
bf6398ae24
commit
839ed2d092
1 changed files with 11 additions and 0 deletions
|
@ -34,6 +34,7 @@
|
||||||
#include <mono/metadata/mono-config.h>
|
#include <mono/metadata/mono-config.h>
|
||||||
#include <mono/metadata/mono-debug.h>
|
#include <mono/metadata/mono-debug.h>
|
||||||
#include <mono/metadata/mono-gc.h>
|
#include <mono/metadata/mono-gc.h>
|
||||||
|
#include <mono/metadata/profiler.h>
|
||||||
|
|
||||||
#include "core/os/dir_access.h"
|
#include "core/os/dir_access.h"
|
||||||
#include "core/os/file_access.h"
|
#include "core/os/file_access.h"
|
||||||
|
@ -79,6 +80,14 @@ void setup_runtime_main_args() {
|
||||||
mono_runtime_set_main_args(main_args.size(), main_args.ptrw());
|
mono_runtime_set_main_args(main_args.size(), main_args.ptrw());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gdmono_profiler_init() {
|
||||||
|
String profiler_args = GLOBAL_DEF("mono/profiler/args", "log:calls,alloc,sample,output=output.mlpd");
|
||||||
|
bool profiler_enabled = GLOBAL_DEF("mono/profiler/enabled", false);
|
||||||
|
if (profiler_enabled) {
|
||||||
|
mono_profiler_load(profiler_args.utf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
|
|
||||||
static bool _wait_for_debugger_msecs(uint32_t p_msecs) {
|
static bool _wait_for_debugger_msecs(uint32_t p_msecs) {
|
||||||
|
@ -265,6 +274,8 @@ void GDMono::initialize() {
|
||||||
|
|
||||||
GDMonoAssembly::initialize();
|
GDMonoAssembly::initialize();
|
||||||
|
|
||||||
|
gdmono_profiler_init();
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
gdmono_debug_init();
|
gdmono_debug_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue