hxtelemetry doesn't work
i suspect the forked verison of hxcpp is causing an issue - googling, i found this https://github.com/jcward/hxtelemetry/issues/42 , which i have the exact same stack trace when compiling (vs2015):
a060308a_HxTelemetry.obj : error LNK2019: unresolved external symbol "int __cdecl __hxcpp_hxt_start_telemetry(bool,bool)" (?__hxcpp_hxt_start_telemetry@@YAH_N0@Z) referenced in function "public: int __thiscall hxtelemetry::HxTelemetry_obj::init_profiler_for_this_thread(void)" (?init_profiler_for_this_thread@HxTelemetry_obj@hxtelemetry@@QAEHXZ)
a060308a_CppHxTelemetry.obj : error LNK2001: unresolved external symbol "int __cdecl __hxcpp_hxt_start_telemetry(bool,bool)" (?__hxcpp_hxt_start_telemetry@@YAH_N0@Z)
a060308a_HxTelemetry.obj : error LNK2019: unresolved external symbol "void __cdecl __hxcpp_hxt_ignore_allocs(int)" (?__hxcpp_hxt_ignore_allocs@@YAXH@Z) referenced in function "public: static void __cdecl hxtelemetry::HxTelemetry_obj::disable_alloc_tracking(bool)" (?disable_alloc_tracking@HxTelemetry_obj@hxtelemetry@@SAX_N@Z)
a060308a_CppHxTelemetry.obj : error LNK2001: unresolved external symbol "void __cdecl __hxcpp_hxt_ignore_allocs(int)" (?__hxcpp_hxt_ignore_allocs@@YAXH@Z)
a060308a_CppHxTelemetry.obj : error LNK2019: unresolved external symbol "void __cdecl __hxcpp_hxt_stash_telemetry(void)" (?__hxcpp_hxt_stash_telemetry@@YAXXZ) referenced in function "public: static void __cdecl hxtelemetry::CppHxTelemetry_obj::do_advance_frame(class hx::ObjectPtr<class hxtelemetry::HxTelemetry_obj>)" (?do_advance_frame@CppHxTelemetry_obj@hxtelemetry@@SAXV?$ObjectPtr@VHxTelemetry_obj@hxtelemetry@@@hx@@@Z)
a060308a_CppHxTelemetry.obj : error LNK2019: unresolved external symbol "struct TelemetryFrame * __cdecl __hxcpp_hxt_dump_telemetry(int)" (?__hxcpp_hxt_dump_telemetry@@YAPAUTelemetryFrame@@H@Z) referenced in function "public: static void __cdecl hxtelemetry::CppHxTelemetry_obj::dump_telemetry_frame(int,class hx::ObjectPtr<class haxe::io::Output_obj>,class Dynamic)" (?dump_telemetry_frame@CppHxTelemetry_obj@hxtelemetry@@SAXHV?$ObjectPtr@VOutput_obj@io@haxe@@@hx@@VDynamic@@@Z) ApplicationMain.exe : fatal error LNK1120: 4 unresolved externals
see https://github.com/Kode/Kha/issues/607 for a workaround
(and secretly snooping around in your repo's :innocent: you could try to use adobe's scout for profiling in flash if thats an option for you)
@sh-dave : yea, i might try flash - tho i really prefer to profile the CPP version since it's more likely to be the final target.
sure, just wanted to point out that the usually biggest performance bottleneck (allocs/gc) is very good to profile in scout (it was actually even better than hxscout the last time i tried). and all problems you have in flash in that regard are likely to be worse in native (seems flash has a better gc).
that said, i only do development on flash, but it won't be a release target for me neighter. but for development it's pretty great
- extremely fast builds compared to native
- very good debugging experience in flash/haxedevelop
- very good profiling support with scout
Seems like managed it to work, based on investigations from #607
Comment whole line: https://github.com/Kode/Kha/blob/c9c5ac70c4d77a50e49df78cc87584a590003afc/korefile.js#L33
Add to khafile.js in your project:
//...
project.addParameter('-D HXCPP_TELEMETRY');
project.addParameter('-D HXCPP_STACK_TRACE');
project.addDefine('HXCPP_DEBUGGER');
project.addCDefine('HXCPP_DEBUGGER');
project.addDefine('HXCPP_PROFILER');
project.addCDefine('HXCPP_PROFILER');
project.addLibrary('hxcpp-debugger');
project.addParameter('-debug');
project.addLibrary('hxtelemetry');
project.addCDefine('HXCPP_TELEMETRY');
project.addCDefine('HXCPP_STACK_TRACE');
project.addDefine('HXCPP_VISIT_ALLOCS');
project.addCDefine('HXCPP_VISIT_ALLOCS');
//...
It looks strange, that HXCPP_TELEMETRY and HXCPP_STACK_TRACE flags added both as parameter with -D and as CDefine, but it is the only way to see all allocations within hxScout , as far as I see.
Add this code:
void __hxcpp_dbg_threadCreatedOrTerminated(int threadNumber, bool created) { }
At this line: https://github.com/Kode/khacpp/blob/1fc1cfc120d7704d4b297f23337134d29d5380e3/src/hx/Debugger.cpp#L1254
With mentioned changes, application connects to hxScout both with VS debugger attached or standalone.
Some of this changes may be excessive or incorrect, but at least it works.
Another good profiler is chrome on html5 target.
I did comment excludes from krom, but it can't be compiled :(
mpty" -static-libgcc -static-libstdc++ -pthread -lasound -ldl -lGL -lX11 -lXinerama
thread.o: In function `__hxcpp_register_current_thread()':
Thread.cpp:(.text+0x1ee5): undefined reference to `__hxcpp_dbg_threadCreatedOrTerminated(int, bool)'
collect2: error: ld returned 1 exit status
makefile:6: recipe for target 'Empty' failed
make: *** [Empty] Error 1
Compilation failed.
upd:
Ahaa, Kha/Backends/Kore/khacpp/src/hx/Thread.cpp:332 isn't commented! now compiled fine!
Used Kha 6a296fba18