Skip to content

Commit 327db05

Browse files
committed
Initial commit.
0 parents  commit 327db05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+23441
-0
lines changed

.github/workflows/main.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
on: [push, pull_request]
2+
3+
defaults:
4+
run:
5+
shell: bash
6+
7+
jobs:
8+
jammy_ccws_static:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
repository: asherikov/ccws
14+
- uses: actions/checkout@v4
15+
with:
16+
path: src/graphite_to_mcap
17+
- run: make bp_install_build BUILD_PROFILE=scan_build
18+
- run: make bp_install_build BUILD_PROFILE=static_checks
19+
- run: mkdir -p src/.ccws
20+
- run: echo "graphite_to_mcap/src/3rdparty/" >> src/.ccws/static_checks.exceptions.paths
21+
- run: make BUILD_PROFILE=static_checks
22+
- run: make dep_install PKG=graphite_to_mcap
23+
- run: make graphite_to_mcap BUILD_PROFILE=scan_build
24+
25+
jammy_ccws_plain_22:
26+
runs-on: ubuntu-22.04
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
repository: asherikov/ccws
31+
- uses: actions/checkout@v4
32+
with:
33+
path: src/graphite_to_mcap
34+
- run: make bp_install_build BUILD_PROFILE=reldebug
35+
- run: make dep_install PKG=graphite_to_mcap
36+
- run: make graphite_to_mcap
37+
- run: make test PKG=graphite_to_mcap
38+
39+
jammy_ccws_plain_24:
40+
runs-on: ubuntu-24.04
41+
steps:
42+
- uses: actions/checkout@v4
43+
with:
44+
repository: asherikov/ccws
45+
- uses: actions/checkout@v4
46+
with:
47+
path: src/graphite_to_mcap
48+
- run: make bp_install_build BUILD_PROFILE=reldebug
49+
- run: make dep_install PKG=graphite_to_mcap
50+
- run: make graphite_to_mcap
51+
- run: make test PKG=graphite_to_mcap
52+
53+
jammy_ccws_threadsan:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
repository: asherikov/ccws
59+
- uses: actions/checkout@v4
60+
with:
61+
path: src/graphite_to_mcap
62+
- run: make bp_install_build BUILD_PROFILE=thread_sanitizer
63+
- run: make dep_install PKG=graphite_to_mcap
64+
- run: make graphite_to_mcap BUILD_PROFILE=thread_sanitizer
65+
- run: make test PKG=graphite_to_mcap BUILD_PROFILE=thread_sanitizer
66+
67+
jammy_ccws_asan:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v4
71+
with:
72+
repository: asherikov/ccws
73+
- uses: actions/checkout@v4
74+
with:
75+
path: src/graphite_to_mcap
76+
- run: make bp_install_build BUILD_PROFILE=addr_undef_sanitizers
77+
- run: make dep_install PKG=graphite_to_mcap
78+
- run: make graphite_to_mcap BUILD_PROFILE=addr_undef_sanitizers
79+
- run: make test PKG=graphite_to_mcap BUILD_PROFILE=addr_undef_sanitizers

CMakeLists.txt

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
cmake_minimum_required(VERSION 3.8)
2+
project(graphite_to_mcap VERSION 0.1.0 LANGUAGES CXX)
3+
4+
# -Wno-error=tsan
5+
# /usr/include/boost/asio/detail/std_fenced_block.hpp:46:29:
6+
# ‘atomic_thread_fence’ is not supported with ‘-fsanitize=thread’ [-Werror=tsan]
7+
if(CCWS_CXX_FLAGS)
8+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CCWS_CXX_FLAGS} -Wno-error=tsan")
9+
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CCWS_LINKER_FLAGS}")
10+
else()
11+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
12+
set(CMAKE_VERBOSE_MAKEFILE ON)
13+
14+
if(NOT CMAKE_CXX_STANDARD)
15+
set(CMAKE_CXX_STANDARD 17)
16+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
17+
endif()
18+
19+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
20+
add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wno-error=tsan)
21+
endif()
22+
endif()
23+
24+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
25+
set(CMAKE_VISIBILITY_INLINES_HIDDEN hidden)
26+
27+
find_package(Boost COMPONENTS headers REQUIRED)
28+
29+
add_subdirectory(src/3rdparty/)
30+
31+
if(CCWS_CLANG_TIDY)
32+
set(CMAKE_CXX_CLANG_TIDY "${CCWS_CLANG_TIDY}" CACHE STRING "" FORCE)
33+
endif()
34+
35+
add_executable(${PROJECT_NAME}
36+
src/graphite_to_mcap.cpp
37+
)
38+
39+
target_link_libraries(${PROJECT_NAME}
40+
"${Boost_LIBRARIES}"
41+
fastcdr
42+
)
43+
44+
target_include_directories(${PROJECT_NAME}
45+
SYSTEM
46+
PRIVATE src/3rdparty/mcap/cpp/mcap/include/
47+
PRIVATE src/3rdparty/mcap/cpp/mcap/include/mcap
48+
PRIVATE src/3rdparty/generated/
49+
)
50+
51+
install(TARGETS ${PROJECT_NAME}
52+
ARCHIVE DESTINATION lib
53+
LIBRARY DESTINATION lib
54+
RUNTIME DESTINATION bin
55+
)

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
`graphite_to_mcap`
2+
------------------
3+
4+
Simple system staticistics collection utility, which accepts data in Graphite
5+
format (`<name> <value> <timestamp>`) and logs it to MCAP files.
6+
7+
- Input data:
8+
- Graphite format
9+
<https://graphite.readthedocs.io/en/latest/feeding-carbon.html#the-plaintext-protocol>
10+
is supported by many utilities, e.g.,
11+
<https://graphite.readthedocs.io/en/latest/tools.html>, but this tool is
12+
mainly intended to work with `collectd` <https://collectd.org/>.
13+
- Disable recommended packages when installing `collectd` in Ubuntu:
14+
otherwise it pulls too much junk, including Java.
15+
- `collectd` reports CPU usage in microseconds, percentage can be obtained
16+
by dividing the value by sampling interval and multiplying by 100. See
17+
https://github.com/collectd/collectd/issues/1633 and
18+
https://github.com/collectd/collectd/issues/2862.
19+
20+
- Output data:
21+
- MCAP <https://mcap.dev/> is handy for storing and analysing data, e.g.,
22+
with PlotJuggler <https://plotjuggler.io/>.
23+
- Data is wrapped in `plotjuggler_msgs`, but all corresponding dependencies
24+
are compiled in and there are no build or runtime dependencies on ROS.

examples/collectd.conf

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
Hostname "s"
2+
FQDNLookup false
3+
AutoLoadPlugin true
4+
Interval 1
5+
6+
<Plugin syslog>
7+
LogLevel info
8+
</Plugin>
9+
10+
<Plugin cpu>
11+
ReportByCpu false
12+
ReportByState true
13+
ValuesPercentage true
14+
</Plugin>
15+
16+
<Plugin df>
17+
# ignore rootfs; else, the root file-system would appear twice, causing
18+
# one of the updates to fail and spam the log
19+
FSType rootfs
20+
# ignore the usual virtual / temporary file-systems
21+
FSType sysfs
22+
FSType proc
23+
FSType devtmpfs
24+
FSType devpts
25+
FSType tmpfs
26+
FSType fusectl
27+
FSType cgroup
28+
FSType squashfs
29+
IgnoreSelected true
30+
31+
ValuesAbsolute true
32+
ValuesPercentage true
33+
</Plugin>
34+
35+
<Plugin interface>
36+
</Plugin>
37+
38+
<Plugin memory>
39+
ValuesAbsolute true
40+
ValuesPercentage false
41+
</Plugin>
42+
43+
<Plugin processes>
44+
# ProcessMatch *must* be used if the name length >= 15 chars
45+
ProcessMatch "collectd" ".*collectd.*"
46+
</Plugin>
47+
48+
<Plugin sensors>
49+
UseLabels true
50+
</Plugin>
51+
52+
<Plugin uptime>
53+
</Plugin>
54+
55+
<Plugin write_graphite>
56+
<Node "example">
57+
Host "localhost"
58+
Port "2003"
59+
Protocol "tcp"
60+
ReconnectInterval 0
61+
LogSendErrors true
62+
Prefix ""
63+
Postfix ""
64+
StoreRates true
65+
AlwaysAppendDS false
66+
EscapeCharacter "_"
67+
SeparateInstances true
68+
PreserveSeparator true
69+
DropDuplicateFields false
70+
</Node>
71+
</Plugin>
72+
73+
<Include "/etc/collectd/collectd.conf.d">
74+
Filter "*.conf"
75+
</Include>

package.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<package format="2">
3+
<name>graphite_to_mcap</name>
4+
<version>0.1.0</version>
5+
<description>System statistics logger</description>
6+
<maintainer email="asherikov@yandex.com">Alexander Sherikov</maintainer>
7+
<license>Apache 2.0</license>
8+
9+
<export>
10+
<build_type>cmake</build_type>
11+
</export>
12+
13+
<buildtool_depend>cmake</buildtool_depend>
14+
<build_depend>libboost-dev</build_depend>
15+
<exec_depend>collectd</exec_depend>
16+
</package>

src/3rdparty/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
add_subdirectory(fastcdr EXCLUDE_FROM_ALL)
2+
get_target_property(INTROMETRY_PJMSG_MCAP_FASTCDR_INCLUDES fastcdr INTERFACE_INCLUDE_DIRECTORIES)
3+
set_target_properties(fastcdr
4+
PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${INTROMETRY_PJMSG_MCAP_FASTCDR_INCLUDES}")
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
###############################################################################
16+
# CMake build rules for FastCDR #
17+
###############################################################################
18+
cmake_minimum_required(VERSION 3.20)
19+
20+
###############################################################################
21+
# Project #
22+
###############################################################################
23+
project(fastcdr VERSION 2.2.6 LANGUAGES CXX)
24+
25+
set(PROJECT_NAME_STYLED "FastCDR")
26+
set(PROJECT_NAME_LARGE "Fast CDR")
27+
string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER)
28+
set(${PROJECT_NAME}_DESCRIPTION_SUMMARY "C++ library for serialize using CDR serialization")
29+
set(${PROJECT_NAME}_DESCRIPTION "eProsima ${PROJECT_NAME_LARGE} library provides two serialization mechanisms. One is the standard CDR serialization mechanism, while the other is a faster implementation that modifies the standard.")
30+
31+
message(STATUS "Configuring ${PROJECT_NAME_LARGE}")
32+
message(STATUS "Version: ${PROJECT_VERSION}")
33+
34+
35+
###############################################################################
36+
# Default shared libraries
37+
###############################################################################
38+
# Global flag to cause add_library() to create shared libraries if on.
39+
# If set to true, this will cause all libraries to be built shared
40+
# unless the library was explicitly added as a static library.
41+
option(BUILD_SHARED_LIBS "Create shared libraries by default" OFF)
42+
43+
###############################################################################
44+
# Test system configuration
45+
###############################################################################
46+
include(${PROJECT_SOURCE_DIR}/cmake/common/check_configuration.cmake)
47+
48+
set(FORCE_CXX "11" CACHE STRING "C++ standard fulfillment selection")
49+
check_stdcxx(${FORCE_CXX})
50+
51+
check_endianness()
52+
check_type_sizes()
53+
54+
###############################################################################
55+
# Installation paths
56+
###############################################################################
57+
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/fastcdr")
58+
59+
set(BIN_INSTALL_DIR bin/ CACHE PATH "Installation directory for binaries")
60+
set(_include_dir "include/")
61+
if(APPEND_PROJECT_NAME_TO_INCLUDEDIR)
62+
string(APPEND _include_dir "${PROJECT_NAME}/")
63+
endif()
64+
set(INCLUDE_INSTALL_DIR "${_include_dir}" CACHE PATH "Installation directory for C++ headers")
65+
unset(_include_dir)
66+
set(LIB_INSTALL_DIR lib${LIB_SUFFIX}/ CACHE PATH "Installation directory for libraries")
67+
set(DATA_INSTALL_DIR share/ CACHE PATH "Installation directory for data")
68+
if(WIN32)
69+
set(DOC_DIR "doc")
70+
else()
71+
set(DOC_DIR "${DATA_INSTALL_DIR}/doc")
72+
endif()
73+
set(DOC_INSTALL_DIR ${DOC_DIR} CACHE PATH "Installation directory for documentation")
74+
set(LICENSE_INSTALL_DIR ${DATA_INSTALL_DIR}/${PROJECT_NAME} CACHE PATH "Installation directory for licenses")
75+
76+
###############################################################################
77+
# Compile library.
78+
###############################################################################
79+
add_subdirectory(src/cpp)
80+

0 commit comments

Comments
 (0)