Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
Slot.cpp
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#include <utility>
19
20#include "./Slot.hpp"
21
22Slot::Slot(const otf2::chrono::duration &start, const otf2::chrono::duration &anEnd,
23 otf2::definition::location* location, otf2::definition::region* region) :
24 startTime(start),
25 endTime(anEnd),
26 location(location),
27 region(region) {
28}
29
30SlotKind Slot::getKind() const {
31 auto regionName = this->region->name().str();
32 if (regionName.starts_with("MPI_")) {
33 return MPI;
34 } else if (regionName.starts_with("!$omp")) {
35 return OpenMP;
36 } else {
37 return Plain;
38 }
39}
40
41types::TraceTime Slot::getStartTime() const {
42 return startTime;
43}
44
45types::TraceTime Slot::getEndTime() const {
46 return endTime;
47}
types::TraceTime endTime
End time of the slot relative to the trace start time.
Definition: Slot.hpp:60
types::TraceTime getStartTime() const override
Returns the start time of the current object.
Definition: Slot.cpp:41
Slot(const otf2::chrono::duration &start, const otf2::chrono::duration &end, otf2::definition::location *location, otf2::definition::region *region)
Creates a new instance of the Slot class.
Definition: Slot.cpp:22
types::TraceTime getEndTime() const override
Returns the start time of the current object.
Definition: Slot.cpp:45
SlotKind getKind() const
Returns the kind of the current Slot object.
Definition: Slot.cpp:30
otf2::chrono::duration startTime
Start time of the slot relative to the trace start time.
Definition: Slot.hpp:55
otf2::definition::region * region
Region the slot occurred in. For example, the source file and line.
Definition: Slot.hpp:70