Browse Source

feat(lite): add get static mem info function in lite c

GitOrigin-RevId: f0d1b3009e
release-1.7
Megvii Engine Team 3 years ago
parent
commit
5e8a9a9597
2 changed files with 24 additions and 0 deletions
  1. +9
    -0
      lite/lite-c/include/lite-c/network_c.h
  2. +15
    -0
      lite/lite-c/src/network.cpp

+ 9
- 0
lite/lite-c/include/lite-c/network_c.h View File

@@ -512,6 +512,15 @@ LITE_API int LITE_enable_io_txt_dump(LiteNetwork network, const char* io_txt_out
*/ */
LITE_API int LITE_enable_io_bin_dump(LiteNetwork network, const char* io_bin_out_dir); LITE_API int LITE_enable_io_bin_dump(LiteNetwork network, const char* io_bin_out_dir);


/**
* \brief get static peak memory info showed by Graph visualization
* \param[in] log_dir The dumped json file directory
* \return int if the return is not zero, error happened, the error message
* can get by LITE_get_last_error
*/
LITE_API int LITE_get_static_memory_alloc_info(
LiteNetwork network, const char* log_dir);

#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif


+ 15
- 0
lite/lite-c/src/network.cpp View File

@@ -558,4 +558,19 @@ int LITE_share_runtime_memroy(LiteNetwork dst_network, LiteNetwork src_network)
LITE_CAPI_END(); LITE_CAPI_END();
} }


int LITE_get_static_memory_alloc_info(LiteNetwork network, const char* log_dir) {
LITE_CAPI_BEGIN();
#ifndef __IN_TEE_ENV__
#if MGB_ENABLE_JSON
LITE_ASSERT(network, "The network pass to LITE api is null");
static_cast<lite::Network*>(network)->get_static_memory_alloc_info(log_dir);
return 0;
#endif
#endif
LITE_MARK_USED_VAR(network);
LITE_MARK_USED_VAR(log_dir);
LITE_THROW("Doesn't support get_static_memory_alloc_info().Please check macro.");
LITE_CAPI_END();
}

// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}} // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}

Loading…
Cancel
Save