Add object allocation info to log message (#1134)
author이성재/동작제어Lab(SR)/Principal Engineer/삼성전자 <sj925.lee@samsung.com>
Wed, 9 May 2018 02:25:24 +0000 (11:25 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 9 May 2018 02:25:24 +0000 (11:25 +0900)
* Add object allocation info to log message

- display `--> (type: address)` information at the end of the log line for each allocation call.

Signed-off-by: Sung-Jae Lee <sj925.lee@samsung.com>
runtimes/logging/src/nnapi_logging.cc

index 9784125..a46480f 100644 (file)
@@ -140,8 +140,10 @@ struct ANeuralNetworksMemory
 ResultCode ANeuralNetworksMemory_createFromFd(size_t size, int protect, int fd, size_t offset,
                                               ANeuralNetworksMemory **memory)
 {
-  std::cout << __FUNCTION__ << "()" << std::endl;
   *memory = new ANeuralNetworksMemory;
+
+  std::cout << __FUNCTION__ << "() --> (memory: " << *memory << ")" << std::endl;
+
   return ANEURALNETWORKS_NO_ERROR;
 }
 
@@ -169,10 +171,10 @@ struct ANeuralNetworksModel
 
 ResultCode ANeuralNetworksModel_create(ANeuralNetworksModel **model)
 {
-  std::cout << __FUNCTION__ << "(" << model << ")" << std::endl;
-
   *model = new ANeuralNetworksModel;
 
+  std::cout << __FUNCTION__ << "(" << model << ") --> (model: " << *model << ")" << std::endl;
+
   return ANEURALNETWORKS_NO_ERROR;
 }
 
@@ -296,10 +298,11 @@ struct ANeuralNetworksCompilation
 ResultCode ANeuralNetworksCompilation_create(ANeuralNetworksModel *model,
                                              ANeuralNetworksCompilation **compilation)
 {
-  std::cout << __FUNCTION__ << "(model: " << model << ")" << std::endl;
-
   *compilation = new ANeuralNetworksCompilation;
 
+  std::cout << __FUNCTION__ << "(model: " << model << ") --> (compilation: " << *compilation << ")"
+            << std::endl;
+
   return ANEURALNETWORKS_NO_ERROR;
 }
 
@@ -321,10 +324,11 @@ struct ANeuralNetworksExecution
 ResultCode ANeuralNetworksExecution_create(ANeuralNetworksCompilation *compilation,
                                            ANeuralNetworksExecution **execution)
 {
-  std::cout << __FUNCTION__ << "(compilation: " << compilation << ")" << std::endl;
-
   *execution = new ANeuralNetworksExecution;
 
+  std::cout << __FUNCTION__ << "(compilation: " << compilation << ") --> (execution: " << *execution
+            << ")" << std::endl;
+
   return ANEURALNETWORKS_NO_ERROR;
 }
 
@@ -364,10 +368,11 @@ ResultCode ANeuralNetworksExecution_setOutput(ANeuralNetworksExecution *executio
 ResultCode ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution *execution,
                                                  ANeuralNetworksEvent **event)
 {
-  std::cout << __FUNCTION__ << "(execution: " << execution << ")" << std::endl;
-
   *event = new ANeuralNetworksEvent;
 
+  std::cout << __FUNCTION__ << "(execution: " << execution << ") --> (event: " << *event << ")"
+            << std::endl;
+
   return ANEURALNETWORKS_NO_ERROR;
 }