This is an automated email from the ASF dual-hosted git repository.
colinlee pushed a commit to branch bench_mark
in repository https://gitbox.apache.org/repos/asf/tsfile.git
The following commit(s) were added to refs/heads/bench_mark by this push:
new cd4ff885 add win benchmark.
cd4ff885 is described below
commit cd4ff885fcd93653b69a5060371d28abdc0be2f3
Author: shuolin_l <[email protected]>
AuthorDate: Thu Apr 17 17:42:33 2025 +0800
add win benchmark.
---
cpp/bench_mark/CMakeLists.txt | 5 +++++
cpp/bench_mark/src/bench_mark_utils.cc | 11 ++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/cpp/bench_mark/CMakeLists.txt b/cpp/bench_mark/CMakeLists.txt
index 36f8dac9..7d7e96c5 100644
--- a/cpp/bench_mark/CMakeLists.txt
+++ b/cpp/bench_mark/CMakeLists.txt
@@ -50,4 +50,9 @@ add_executable(bench_mark
src/bench_mark_c.cc
src/bench_mark.cc
src/bench_mark_utils.cc)
+
+if (WIN32)
+ target_link_libraries(bench_mark Psapi)
+endif()
+
target_link_libraries(bench_mark tsfile)
diff --git a/cpp/bench_mark/src/bench_mark_utils.cc
b/cpp/bench_mark/src/bench_mark_utils.cc
index 841f8c0c..c4b4562f 100644
--- a/cpp/bench_mark/src/bench_mark_utils.cc
+++ b/cpp/bench_mark/src/bench_mark_utils.cc
@@ -18,13 +18,19 @@
*/
#include "bench_mark_utils.h"
-
+#ifndef _WIN32
#include <sys/resource.h>
+#endif
#include <fstream>
#include <iostream>
#include <string>
+#ifdef _WIN32
+#include <windows.h>
+#include <psapi.h>
+#endif
+
#ifdef __APPLE__
#include <mach/mach_init.h>
#include <mach/message.h>
@@ -77,8 +83,6 @@ void print_progress_bar(int current, int total, int barWidth)
{
int get_memory_usage() {
#ifdef _WIN32
-#include <window.h>
-#include <psapi.h>
PROCESS_MEMORY_COUNTERS pmc;
if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
return pmc.WorkingSetSize / 1024 ;
@@ -100,6 +104,7 @@ int get_memory_usage() {
}
}
}
+ return 0;
#elif defined(__APPLE__)
task_basic_info_data_t info;