Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
UITrace.hpp
1/*
2 * Marvelous OTF2 Traces Interactive Visualizer (MOTIV)
3 * Copyright (C) 2023 Florian Gallrein, Björn Gehrke
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18#ifndef MOTIV_UITRACE_HPP
19#define MOTIV_UITRACE_HPP
20
21
22#include <utility>
23
24#include "SubTrace.hpp"
25#include "Range.hpp"
26
30#define MIN_SLOT_SIZE_PX 5
31
35#define MIN_COMMUNICATION_SIZE_PX 15
36
40#define MIN_COLLECTIVE_EVENT_SIZE_PX 10
41
48class UITrace : public SubTrace {
49private:
60 UITrace(std::map<otf2::definition::location_group *, std::vector<Slot *>, LocationGroupCmp> slotsVec,
61 const Range<Communication *> &communications,
62 const Range<CollectiveCommunicationEvent *> &collectiveCommunications,
63 const otf2::chrono::duration &runtime, const otf2::chrono::duration &startTime,
64 const otf2::chrono::duration &timePerPx);
65
66public:
76 static UITrace *forResolution(Trace *trace, otf2::chrono::duration timePerPixel);
77
78
88 static UITrace *forResolution(Trace *trace, int width);
89
93 Trace *subtrace(otf2::chrono::duration from, otf2::chrono::duration to) override;
94
95private:
99 otf2::chrono::duration timePerPx_;
109 aggregateCollectiveCommunications(const CollectiveCommunicationEvent *intervalStarter,
110 std::vector<CollectiveCommunicationEvent *> &stats);
111
120 static Slot *aggregateSlots(const Slot *intervalStarter, std::map<SlotKind, std::vector<Slot *>> &stats);
121
130 template<class T>
131 requires std::is_base_of_v<TimedElement, T>
132 static std::vector<T *> optimize(
133 types::TraceTime minDuration,
134 Range<T *> elements,
135 std::function<T *(T *, std::vector<T *> &stats)> aggregate);
136
150 template<class T, typename K>
151 requires std::is_base_of_v<TimedElement, T>
152 static std::vector<T *> optimize(
153 types::TraceTime minDuration,
154 Range<T *> &elements,
155 std::function<K(const T *)> keySelector,
156 std::function<T *(T *, std::map<K, std::vector<T *>> &stats)> aggregate);
157};
158
159#endif //MOTIV_UITRACE_HPP
A class representing an MPI collective operation.
A custom range implementation around std::vector<T>s.
Definition: Range.hpp:37
A Slot represents a visual slot to be rendered in the UI. It contains the information of a location.
Definition: Slot.hpp:37
Trace representing a section of a larger trace.
Definition: SubTrace.hpp:28
Abstract base class for a trace.
Definition: Trace.hpp:52
Trace facilitating a subtrace optimized for rendering.
Definition: UITrace.hpp:48
Trace * subtrace(otf2::chrono::duration from, otf2::chrono::duration to) override
Creates a subtrace of the current trace.
Definition: UITrace.cpp:214
static UITrace * forResolution(Trace *trace, otf2::chrono::duration timePerPixel)
Definition: UITrace.cpp:43
A comparator for otf2::definition::location_group objects.
Definition: Trace.hpp:34