Commit d93b72b5 by alex-weaver Committed by Tianqi Chen

[RPC] Added native debug logging to Android RPC (#1432)

parent a566d36b
...@@ -6,6 +6,18 @@ ...@@ -6,6 +6,18 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fstream> #include <fstream>
/* Enable custom logging - this will cause TVM to pass every log message
* through CustomLogMessage instead of LogMessage. By enabling this, we must
* implement dmlc::CustomLogMessage::Log. We use this to pass TVM log
* messages to Android logcat.
*/
#define DMLC_LOG_CUSTOMIZE 1
/* Ensure that fatal errors are passed to the logger before throwing
* in LogMessageFatal
*/
#define DMLC_LOG_BEFORE_THROW 1
#include "../src/runtime/c_runtime_api.cc" #include "../src/runtime/c_runtime_api.cc"
#include "../src/runtime/cpu_device_api.cc" #include "../src/runtime/cpu_device_api.cc"
#include "../src/runtime/workspace_pool.cc" #include "../src/runtime/workspace_pool.cc"
...@@ -34,3 +46,12 @@ ...@@ -34,3 +46,12 @@
#include "../src/runtime/vulkan/vulkan_device_api.cc" #include "../src/runtime/vulkan/vulkan_device_api.cc"
#include "../src/runtime/vulkan/vulkan_module.cc" #include "../src/runtime/vulkan/vulkan_module.cc"
#endif #endif
#include <android/log.h>
void dmlc::CustomLogMessage::Log(const std::string& msg) {
// This is called for every message logged by TVM.
// We pass the message to logcat.
__android_log_write(ANDROID_LOG_DEBUG, "TVM_RUNTIME", msg.c_str());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment