-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from eProsima/develop
Release 2.0.0
- Loading branch information
Showing
29 changed files
with
1,512 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Copyright 2017-present Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(microxrcedds-profiling) | ||
|
||
ExternalProject_Add(clientlib | ||
GIT_REPOSITORY | ||
https://github.com/eProsima/Micro-XRCE-DDS-Client.git | ||
GIT_TAG | ||
${_client_tag} | ||
PREFIX | ||
${PROJECT_BINARY_DIR}/client | ||
INSTALL_DIR | ||
${PROJECT_BINARY_DIR}/install | ||
CMAKE_CACHE_ARGS | ||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
) | ||
|
||
ExternalProject_Add(agentlib | ||
GIT_REPOSITORY | ||
https://github.com/eProsima/Micro-XRCE-DDS-Agent.git | ||
GIT_TAG | ||
${_agent_tag} | ||
PREFIX | ||
${PROJECT_BINARY_DIR}/agent | ||
INSTALL_DIR | ||
${PROJECT_BINARY_DIR}/install | ||
CMAKE_CACHE_ARGS | ||
-DBUILD_SHARED_LIBS:BOOL=FALSE | ||
-DCMAKE_BUILD_TYPE:STRING=MinSizeRel | ||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
-DUAGENT_FAST_PROFILE:BOOL=FALSE | ||
-DUAGENT_DISCOVERY_PROFILE:BOOL=FALSE | ||
-DUAGENT_P2P_PROFILE:BOOL=FALSE | ||
-DUAGENT_LOGGER_PROFILE:BOOL=FALSE | ||
-DUAGENT_SERVER_BUFFER_SIZE:STRING=1024 | ||
) | ||
|
||
ExternalProject_Add(publisher | ||
SOURCE_DIR | ||
${CMAKE_CURRENT_LIST_DIR}/publisher | ||
PREFIX | ||
${PROJECT_BINARY_DIR}/publisher | ||
INSTALL_DIR | ||
${PROJECT_BINARY_DIR}/install | ||
CMAKE_CACHE_ARGS | ||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
-DCMAKE_PREFIX_PATH:PATH=${PROJECT_BINARY_DIR}/install | ||
DEPENDS | ||
clientlib | ||
) | ||
|
||
ExternalProject_Add(subscriber | ||
SOURCE_DIR | ||
${CMAKE_CURRENT_LIST_DIR}/subscriber | ||
PREFIX | ||
${PROJECT_BINARY_DIR}/subscriber | ||
INSTALL_DIR | ||
${PROJECT_BINARY_DIR}/install | ||
CMAKE_CACHE_ARGS | ||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
-DCMAKE_PREFIX_PATH:PATH=${PROJECT_BINARY_DIR}/install | ||
DEPENDS | ||
clientlib | ||
) | ||
|
||
ExternalProject_Add(agent | ||
SOURCE_DIR | ||
${CMAKE_CURRENT_LIST_DIR}/agent | ||
PREFIX | ||
${PROJECT_BINARY_DIR}/agent | ||
INSTALL_DIR | ||
${PROJECT_BINARY_DIR}/install | ||
CMAKE_CACHE_ARGS | ||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
-DCMAKE_PREFIX_PATH:PATH=<INSTALL_DIR> | ||
DEPENDS | ||
agentlib | ||
) | ||
|
||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/agent-profiling.py DESTINATION ${PROJECT_BINARY_DIR}) | ||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/publisher-profiling.py DESTINATION ${PROJECT_BINARY_DIR}) | ||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/subscriber-profiling.py DESTINATION ${PROJECT_BINARY_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Profiling test | ||
|
||
Profiling test is composed of three components: | ||
|
||
* A minimal Agent with just `UAGENT_CED_PROFILE` enable. | ||
* A publisher developed with the Client library. | ||
* A subscriber developed with the Client library. | ||
|
||
## Why? | ||
|
||
There are some scenarios where the Agent must run over low resource devices, so it is needed to characterize the minimum requirements of the Agent in terms of memory footprint. | ||
In that sense, the Agent profiling with the lowest memory footprint is the one that only use the `CedMiddleware` implementation without logger, cli, and p2p. | ||
Such configuration could be address disabling all the Agent's profiles except the `UAGENT_CED_PROFILE`. | ||
|
||
## How? | ||
|
||
```bash | ||
cmake .. -DUXRCE_ENABLE_CLIENT=OFF -DUXRCE_ENABLE_AGENT=OFF -DUXRCE_BUILD_PROFILING=ON | ||
cmake --build . | ||
cd build/test/profiling | ||
python3 agent-profiling.py | ||
python3 publisher-profiling.py | ||
python3 subscriber-profiling.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import msparser | ||
import os | ||
import signal | ||
import subprocess | ||
import sys | ||
import time | ||
import matplotlib.pyplot as plt | ||
from tabulate import tabulate | ||
|
||
n_pubsub = [1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5] | ||
topic_size = [1 << 8, 1 << 3] | ||
stack_usage = [] | ||
heap_usage = [] | ||
total_usage = [] | ||
|
||
for t in topic_size: | ||
stack = [t] | ||
heap = [t] | ||
total = [t] | ||
for n in n_pubsub: | ||
agent_sp = subprocess.Popen(("valgrind --tool=massif --stacks=yes --detailed-freq=1 --max-snapshots=300 --threshold=0.0 --massif-out-file=./massif-agent.out ./install/bin/agent-profiling").split(), shell=False) | ||
time.sleep(1) | ||
|
||
client_key = 1 | ||
sub_sps = [] | ||
pub_sps = [] | ||
for i in range(n): | ||
sub_sps.append(subprocess.Popen(["./install/bin/subscriber-profiling {} topic_name_{}".format(client_key, i)], shell=True)) | ||
client_key += 1 | ||
pub_sps.append(subprocess.Popen(["./install/bin/publisher-profiling {} topic_name_{} {}".format(client_key, i, t)], shell=True)) | ||
client_key += 1 | ||
|
||
time.sleep(5) | ||
|
||
for i in range(n): | ||
pub_sps[i].terminate() | ||
sub_sps[i].terminate() | ||
|
||
agent_sp.send_signal(signal.SIGINT) | ||
time.sleep(1.0) | ||
|
||
data = msparser.parse_file('massif-agent.out') | ||
peak_index = data['peak_snapshot_index'] | ||
peak_snapshot = data['snapshots'][peak_index] | ||
for c in peak_snapshot['heap_tree']['children']: | ||
if c['details'] and c['details']['function'] == '???': | ||
std_heap = c['nbytes'] | ||
|
||
stack.append(round((peak_snapshot['mem_stack'] / 1000), 2)) | ||
heap.append(round((peak_snapshot['mem_heap'] / 1000), 2)) | ||
total.append(round(((peak_snapshot['mem_stack'] + peak_snapshot['mem_heap'] + peak_snapshot['mem_heap_extra'] - std_heap) / 1000), 2)) | ||
|
||
stack_usage.append(stack) | ||
heap_usage.append(heap) | ||
total_usage.append(total) | ||
|
||
fig, ax = plt.subplots() | ||
for i in range(len(topic_size)): | ||
ax.scatter(n_pubsub, total_usage[i][1:], label="topic size = {} B".format(topic_size[i])) | ||
ax.set_ylim(bottom=1) | ||
ax.set_xlabel("Number of topics") | ||
ax.set_ylabel("Memory usage (KB)") | ||
ax.legend() | ||
plt.show() | ||
|
||
table_header = ["topic size (B) / #topics"] | ||
for n in n_pubsub: | ||
table_header.append(n) | ||
|
||
print(tabulate(total_usage, headers=table_header)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
# Copyright 2017-present Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(agent-profiling) | ||
|
||
find_package(microxrcedds_agent) | ||
|
||
add_executable(${PROJECT_NAME} main.cpp) | ||
|
||
target_link_libraries(${PROJECT_NAME} | ||
PRIVATE | ||
microxrcedds_agent | ||
) | ||
|
||
install( | ||
TARGETS | ||
${PROJECT_NAME} | ||
RUNTIME DESTINATION | ||
bin | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2017-present Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include <uxr/agent/transport/udp/UDPv4AgentLinux.hpp> | ||
|
||
int main() | ||
{ | ||
eprosima::uxr::UDPv4Agent agent(2020, eprosima::uxr::Middleware::Kind::CED); | ||
agent.start(); | ||
|
||
while (true) { | ||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); | ||
} | ||
|
||
return 0; | ||
} |
Oops, something went wrong.