Skip to content

Commit 0d031d8

Browse files
authored
Merge pull request #415 from opcm/push-2022-07-19-2
Push 2022 07 19
2 parents b3fc57c + b37dba5 commit 0d031d8

25 files changed

+1607
-1399
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version.h export-subst
1+
src/version.h export-subst
22
.cirrus.yml export-ignore
33
.gitlab-ci.yml export-ignore
44
.travis.yml export-ignore

.github/workflows/ci-clang-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
- name: Scan build
2828
run: |
2929
cd ${{ github.workspace }}/build
30-
scan-build --exclude simdjson --status-bugs make -j
30+
scan-build --exclude src/simdjson --status-bugs make -j

.github/workflows/ci-test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,15 @@ jobs:
6363
with:
6464
name: test-log-raw-tr-wi_ext-single_header-${{ github.sha }}
6565
path: build/bin/raw_tr_wi_ext_single_header.csv
66+
67+
- name: upload-artifact
68+
uses: actions/upload-artifact@v2
69+
with:
70+
name: test-log-raw-edp-${{ github.sha }}
71+
path: build/bin/raw_edp.txt
72+
73+
- name: upload-artifact
74+
uses: actions/upload-artifact@v2
75+
with:
76+
name: test-log-raw-json-${{ github.sha }}
77+
path: build/bin/raw_json.json

.github/workflows/clang_scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
- name: scan-build
3939
run: |
4040
cd ${{ github.workspace }}/build
41-
scan-build --status-bugs make -j
41+
scan-build --exclude src/simdjson --status-bugs make -j

CMakeLists.txt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,6 @@ if(UNIX) # APPLE, LINUX, FREE_BSD
5555

5656
endif(UNIX)
5757

58-
# interface library for simdjson
59-
add_library(PCM_SIMDJSON INTERFACE)
60-
find_package(simdjson QUIET)
61-
if(simdjson_FOUND)
62-
target_link_libraries(PCM_SIMDJSON INTERFACE simdjson::simdjson)
63-
target_compile_definitions(PCM_SIMDJSON INTERFACE SYSTEM_SIMDJSON)
64-
else()
65-
message("simdjson not found in system, falling back to wrapper")
66-
file(GLOB SIMDJSON_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/simdjson_wrapper.cpp)
67-
target_sources(PCM_SIMDJSON INTERFACE ${SIMDJSON_SOURCE})
68-
target_include_directories(PCM_SIMDJSON INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src)
69-
endif(simdjson_FOUND)
70-
7158
#######################
7259
# Install
7360
#######################

src/CMakeLists.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,50 @@ if(MSVC)
7777

7878
endif(MSVC)
7979

80+
#######################
81+
# SIMDJSON dependency
82+
#######################
83+
84+
add_library(PCM_SIMDJSON INTERFACE) # interface library for simdjson
85+
set(SIMDJSON_IS_APPLICABLE TRUE) # true if simdjson can be used, default - TRUE
86+
87+
# check simdjson support matrix - https://github.com/simdjson/simdjson/blob/master/doc/basics.md
88+
# > GCC 7.4, > Clang 6.0 , > MSVC 2017
89+
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.4) OR
90+
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6) OR
91+
(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND MSVC_TOOLSET_VERSION VERSION_LESS 141)) # corresponds to VS2017
92+
message(WARNING
93+
" ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_VERSION} is incompartible with simdjson features' requirements.\n"
94+
" Refer to simdjson support matrix - https://github.com/simdjson/simdjson/blob/master/doc/basics.md .\n"
95+
" Parsing events from 01.org/perfmon won't be supported.")
96+
set(SIMDJSON_IS_APPLICABLE FALSE)
97+
endif()
98+
99+
if(SIMDJSON_IS_APPLICABLE)
100+
find_package(simdjson QUIET) # Working form Ububtu 22.04
101+
if(simdjson_FOUND)
102+
message(STATUS "System SIMDJSON is used")
103+
target_link_libraries(PCM_SIMDJSON INTERFACE simdjson::simdjson)
104+
target_compile_definitions(PCM_SIMDJSON INTERFACE SYSTEM_SIMDJSON)
105+
target_compile_definitions(PCM_SIMDJSON INTERFACE PCM_SIMDJSON_AVAILABLE)
106+
else()
107+
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/simdjson/singleheader/simdjson.h")
108+
message(STATUS "Local SIMDJSON exists: ${CMAKE_CURRENT_SOURCE_DIR}/simdjson/singleheader/simdjson.h")
109+
file(GLOB SIMDJSON_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/simdjson/singleheader/simdjson.cpp)
110+
target_sources(PCM_SIMDJSON INTERFACE ${SIMDJSON_SOURCE})
111+
target_include_directories(PCM_SIMDJSON INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/simdjson/singleheader)
112+
target_compile_definitions(PCM_SIMDJSON INTERFACE PCM_SIMDJSON_AVAILABLE)
113+
else()
114+
message(WARNING
115+
" ${CMAKE_CURRENT_SOURCE_DIR}/simdjson/singleheader/simdjson.h doesn't exist\n"
116+
" Run 'git clone https://github.com/simdjson/simdjson.git' in 'src' directory to get simdjson library")
117+
endif()
118+
endif(simdjson_FOUND)
119+
endif(SIMDJSON_IS_APPLICABLE)
120+
121+
#######################
122+
# End of SIMDJSON dependency section
123+
#######################
80124

81125
foreach(PROJECT_NAME ${PROJECT_NAMES})
82126
file(GLOB PROJECT_FILE ${PROJECT_NAME}.cpp)

src/client/client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ namespace PCMDaemon {
103103
}
104104
int maxCharsToRead = 11;
105105
char readBuffer[maxCharsToRead];
106-
if (fread(&readBuffer, maxCharsToRead, 1, fp) == 0)
106+
if (fread(&readBuffer, maxCharsToRead, 1, fp) == 0 && feof(fp) == 0)
107107
{
108108
fclose (fp);
109109
std::stringstream ss;

0 commit comments

Comments
 (0)