-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework ring-buffer interface in prep of OMPT
Currently, lo2s creates on piece of shared memory (using shm_open) to share one ring-buffer between lo2s and the child process. Without the headache of synchronizing multiple event sources, this ring-buffer can only be used by one event source, in this case it is currently only used by CUPTI. As a replacement, we offer a Unix Domain Socket (by default /tmp/lo2s.socket). A source interested in submitting events to lo2s creates a piece of shared memory and then sends the FD associated with the Shared Memory to the lo2s socket. lo2s then also maps the shared memory associated with that fd, and the programs can communicate over that. Every ring-buffer is read by its own RingbufMonitor thread. This allows for an arbitrary amount of different measurement paradigms in different threads to connect themselves to lo2s via shared memory (one ringbuffer per OMPT thread, one ringbuffer per CUDA process etc.)
- Loading branch information
Showing
28 changed files
with
594 additions
and
145 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
set(TESTS lo2s_user_sampling) | ||
|
||
foreach(TEST ${TESTS}) | ||
|
||
add_test(NAME ${TEST} COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests/${TEST}.sh) | ||
set_tests_properties(${TEST} PROPERTIES SKIP_RETURN_CODE 100) | ||
endforeach() |
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 @@ | ||
set -euo pipefail | ||
|
||
paranoid=$(cat /proc/sys/kernel/perf_event_paranoid) | ||
|
||
echo "perf_event_paranoid is: $paranoid" | ||
if [ $paranoid -gt 2 ] | ||
then | ||
# skip | ||
exit 100 | ||
fi | ||
|
||
#!/bin/bash | ||
rm -rf test_trace | ||
./lo2s -c 1 --output-trace test_trace -- sleep 1 | ||
|
||
if otf2-print test_trace/traces.otf2 | grep "SAMPLE" | ||
then | ||
exit 0 | ||
else | ||
echo "Trace did not contain calling context samples!" | ||
exit 1 | ||
fi | ||
rm -rf test_trace | ||
|
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 was deleted.
Oops, something went wrong.
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
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,53 @@ | ||
/* | ||
* This file is part of the lo2s software. | ||
* Linux OTF2 sampling | ||
* | ||
* Copyright (c) 2016-2018, Technische Universitaet Dresden, Germany | ||
* | ||
* lo2s is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* lo2s is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with lo2s. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <lo2s/monitor/fwd.hpp> | ||
#include <lo2s/monitor/main_monitor.hpp> | ||
#include <lo2s/monitor/poll_monitor.hpp> | ||
#include <lo2s/ringbuf.hpp> | ||
|
||
namespace lo2s | ||
{ | ||
namespace monitor | ||
{ | ||
|
||
class RingbufMonitor : public PollMonitor | ||
{ | ||
public: | ||
RingbufMonitor(trace::Trace& trace, int fd); | ||
|
||
void initialize_thread() override; | ||
void finalize_thread() override; | ||
void monitor(int fd) override; | ||
|
||
std::string group() const override | ||
{ | ||
return "lo2s::RingbufMonitor"; | ||
} | ||
|
||
private: | ||
trace::Trace& trace_; | ||
perf::time::Converter& time_converter_; | ||
RingBufReader ringbuf_reader_; | ||
}; | ||
} // namespace monitor | ||
} // namespace lo2s |
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,60 @@ | ||
/* | ||
* This file is part of the lo2s software. | ||
* Linux OTF2 sampling | ||
* | ||
* Copyright (c) 2016-2018, Technische Universitaet Dresden, Germany | ||
* | ||
* lo2s is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* lo2s is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with lo2s. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <lo2s/monitor/fwd.hpp> | ||
#include <lo2s/monitor/main_monitor.hpp> | ||
#include <lo2s/monitor/poll_monitor.hpp> | ||
|
||
#include <lo2s/monitor/ringbuf_monitor.hpp> | ||
|
||
extern "C" | ||
{ | ||
#include <sched.h> | ||
#include <unistd.h> | ||
} | ||
|
||
namespace lo2s | ||
{ | ||
namespace monitor | ||
{ | ||
|
||
class SocketMonitor : public PollMonitor | ||
{ | ||
public: | ||
SocketMonitor(trace::Trace& trace); | ||
|
||
void initialize_thread() override; | ||
void finalize_thread() override; | ||
void monitor(int fd) override; | ||
|
||
std::string group() const override | ||
{ | ||
return "lo2s::SocketMonitor"; | ||
} | ||
|
||
private: | ||
trace::Trace& trace_; | ||
std::map<int, RingbufMonitor> monitors_; | ||
int socket = -1; | ||
}; | ||
} // namespace monitor | ||
} // namespace lo2s |
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
Oops, something went wrong.