Skip to content

Commit e2b9dfc

Browse files
authored
add online report (#1057)
* add online report
1 parent 1f41cbd commit e2b9dfc

26 files changed

+3124
-1
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ OPTION (TENGINE_ENABLE_ALL_SYMBOL "All symbol visible"
9090
# Experimental optinos
9191
OPTION (TENGINE_ENABLE_MODEL_CACHE "NPU kernel cache file option" OFF)
9292

93+
# Online report
94+
OPTION (TENGINE_ONLINE_REPORT "online report" ON)
95+
9396
# Do check list
9497
INCLUDE ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/check.cmake")
9598
INCLUDE ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cuda.cmake")

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ Tengine Lite 参考和借鉴了下列项目:
101101

102102
- [Apache 2.0](LICENSE)
103103

104+
## 澄清说明
105+
106+
- [在线上报功能] 在线上报功能主要目的是了解Tengine的使用信息,信息用于优化和迭代Tengine,不会影响任何正常功能。该功能默认开启,如需关闭,可修改如下配置关闭:(主目录 CMakeLists.txt ) OPTION (TENGINE_ONLINE_REPORT "online report" OFF)
107+
104108
## FAQ
105109

106110
- [FAQ 常见问题](doc/faq.md)

cmake/summary.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ MESSAGE (STATUS "${PROJECT_NAME} other infomation:")
5959
# show building install path
6060
MESSAGE (STATUS " Package install path: ${CMAKE_INSTALL_PREFIX}")
6161
MESSAGE (STATUS "")
62+
63+
IF (TENGINE_ONLINE_REPORT)
64+
MESSAGE (WARNING " - Tengine Online Report is : " ${TENGINE_ONLINE_REPORT})
65+
ENDIF()

source/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,15 @@ LIST (APPEND TENGINE_LINK_LIBRARIES ${TENGINE_MODULE_LINK_LIBRARIES})
237237
LIST (APPEND TENGINE_LINK_LIBRARIES ${TENGINE_OPTIMIZER_LINK_LIBRARIES})
238238
LIST (APPEND TENGINE_LINK_LIBRARIES ${TENGINE_UTILITY_LINK_LIBRARIES})
239239

240-
240+
# Online report
241+
IF (NOT MSVC)
242+
IF (TENGINE_ONLINE_REPORT)
243+
ADD_DEFINITIONS(-DTENGINE_ONLINE_REPORT=1)
244+
LIST (APPEND TENGINE_HEADER_PATH "${CMAKE_SOURCE_DIR}/source/olreport/include/")
245+
FILE (GLOB_RECURSE TENGINE_ONLINE_REPORT_SRCS "${CMAKE_SOURCE_DIR}/source/olreport/*.c")
246+
LIST (APPEND TENGINE_SOURCE_FILES ${TENGINE_ONLINE_REPORT_SRCS})
247+
ENDIF()
248+
ENDIF()
241249

242250
# add static and shared target
243251
ADD_LIBRARY (${TENGINE_LITE_NAME}-static STATIC ${TEngine_NEXT_LIB_SRCS})

source/api/c_api.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
#include <stdarg.h>
5454
#include <string.h>
5555

56+
#ifdef TENGINE_ONLINE_REPORT
57+
#include "tenginereportmgr.h"
58+
#endif
59+
5660
#define STR_VERSION2(a) #a
5761
#define STR_VERSION(a) STR_VERSION2(a)
5862

@@ -298,6 +302,12 @@ int init_tengine(void)
298302
return ret;
299303
}
300304

305+
#ifdef TENGINE_ONLINE_REPORT
306+
hcl_version = get_tengine_version();
307+
init_tengine_report_mgr();
308+
do_tengine_report(ACTION_INIT);
309+
#endif
310+
301311
init_flag++;
302312

303313
return ret;
@@ -340,6 +350,10 @@ void release_tengine(void)
340350
TLOG_ERR("Tengine: Unregister neural network devices failed: %d\n", ret);
341351
}
342352

353+
#ifdef TENGINE_ONLINE_REPORT
354+
release_tengine_report_mgr();
355+
#endif
356+
343357
init_flag = 0;
344358
}
345359

0 commit comments

Comments
 (0)