2022-05-19 20:52:19 +08:00
|
|
|
#include "test_common.h"
|
2021-10-01 00:21:50 +08:00
|
|
|
|
2021-11-16 16:25:22 +08:00
|
|
|
extern "C" {
|
|
|
|
#include "dataMemory.h"
|
2022-05-02 19:49:47 +08:00
|
|
|
#include "pika_config_gtest.h"
|
2021-11-16 16:25:22 +08:00
|
|
|
}
|
|
|
|
|
2022-10-28 19:19:31 +08:00
|
|
|
extern "C" {
|
2023-03-06 14:39:04 +08:00
|
|
|
void test_purec(void);
|
2022-10-28 19:19:31 +08:00
|
|
|
}
|
|
|
|
|
2021-10-01 00:21:50 +08:00
|
|
|
int main(int argc, char** argv) {
|
2022-10-28 18:39:50 +08:00
|
|
|
int res = 0;
|
|
|
|
#if USE_GOOGLE_TEST
|
2021-11-16 16:25:22 +08:00
|
|
|
::testing::InitGoogleTest(&argc, argv);
|
2022-10-28 18:39:50 +08:00
|
|
|
res = RUN_ALL_TESTS();
|
2022-10-28 19:19:31 +08:00
|
|
|
#else
|
|
|
|
test_purec();
|
2022-10-28 18:39:50 +08:00
|
|
|
#endif
|
2022-05-02 19:55:02 +08:00
|
|
|
mem_pool_deinit();
|
2022-10-09 00:24:33 +08:00
|
|
|
#if PIKA_ARG_CACHE_ENABLE
|
2023-03-06 14:39:04 +08:00
|
|
|
extern PikaMemInfo g_PikaMemInfo;
|
|
|
|
#if PIKA_GC_MARK_SWEEP_ENABLE
|
|
|
|
extern PikaObjState g_PikaObjState;
|
|
|
|
printf("[ GC]: object num max: %d, last GC: %d\r\n",
|
|
|
|
g_PikaObjState.objCntMax, g_PikaObjState.objCntLastGC);
|
|
|
|
#endif
|
2022-10-09 00:24:33 +08:00
|
|
|
printf("[ Info]: alloc times: %d, cached times: %d (%0.2f%%)\r\n",
|
2023-03-06 14:39:04 +08:00
|
|
|
g_PikaMemInfo.alloc_times, g_PikaMemInfo.alloc_times_cache,
|
|
|
|
((float)g_PikaMemInfo.alloc_times_cache /
|
|
|
|
(float)g_PikaMemInfo.alloc_times) *
|
2022-10-09 00:24:33 +08:00
|
|
|
100.0);
|
|
|
|
#endif
|
2022-05-02 19:55:02 +08:00
|
|
|
return res;
|
2021-10-01 00:21:50 +08:00
|
|
|
}
|