| 1 |
/* Copyright (C) 2022-2025 Free Software Foundation |
| 2 |
|
| 3 |
This program is free software; you can redistribute it and/or modify |
| 4 |
it under the terms of the GNU General Public License as published by |
| 5 |
the Free Software Foundation, either version 3 of the License, or |
| 6 |
(at your option) any later version. |
| 7 |
|
| 8 |
This program is distributed in the hope that it will be useful, |
| 9 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
GNU General Public License for more details. |
| 12 |
|
| 13 |
You should have received a copy of the GNU General Public License |
| 14 |
along with this program. If not, see <http://www.gnu.org/licenses>. */ |
| 15 |
|
| 16 |
package org.gprofng.mpmt.timeline.events; |
| 17 |
|
| 18 |
import org.gprofng.mpmt.AnInteger; |
| 19 |
import org.gprofng.mpmt.AnLocale; |
| 20 |
import org.gprofng.mpmt.AnLong; |
| 21 |
import org.gprofng.mpmt.statecolors.StackState; |
| 22 |
import java.util.List; |
| 23 |
|
| 24 |
public final class MPIEvent extends ExtendedEvent implements DurationEvent { |
| 25 |
private final String[] LABELS = { |
| 26 |
AnLocale.getString("Duration (msec.):"), // NOI18N |
| 27 |
AnLocale.getString("Sub-Type:"), // NOI18N |
| 28 |
AnLocale.getString("Message Count:"), // NOI18N |
| 29 |
AnLocale.getString("Bytes:") // NOI18N |
| 30 |
}; |
| 31 |
|
| 32 |
// This order has to match what's in data_pckts.h for MPI stuff |
| 33 |
private static final String[] MPITYPES = { |
| 34 |
"mpisend", // NOI18N |
| 35 |
"mpireceive", // NOI18N |
| 36 |
"mpisendrecv", // NOI18N |
| 37 |
"mpiother" // NOI18N |
| 38 |
}; |
| 39 |
|
| 40 |
// passed to constructor |
| 41 |
private final long duration; // in nanosec |
| 42 |
private final int sub_type, msg_cnt; |
| 43 |
private final long msg_bytes; |
| 44 |
private final String[] eventSpecificInfo; |
| 45 |
|
| 46 |
public MPIEvent( |
| 47 |
int lwpid, |
| 48 |
int thrid, |
| 49 |
int cpuid, |
| 50 |
long ts, |
| 51 |
long stack, |
| 52 |
long func, |
| 53 |
List<StackState> stackStates, |
| 54 |
long duration, |
| 55 |
int msg_cnt, |
| 56 |
int sub_type, |
| 57 |
long msg_bytes, |
| 58 |
long time_adjust) { |
| 59 |
super(lwpid, thrid, cpuid, ts, stack, func, time_adjust, stackStates); |
| 60 |
|
| 61 |
this.duration = duration; |
| 62 |
this.sub_type = sub_type; |
| 63 |
this.msg_cnt = msg_cnt; |
| 64 |
this.msg_bytes = msg_bytes; |
| 65 |
this.eventSpecificInfo = initEventSpecificInfo(); |
| 66 |
} |
| 67 |
|
| 68 |
public String[] getEventSpecificInfo() { |
| 69 |
String[] rc = this.eventSpecificInfo.clone(); |
| 70 |
return rc; |
| 71 |
} |
| 72 |
|
| 73 |
private String[] initEventSpecificInfo() { |
| 74 |
return new String[] { |
| 75 |
new AnLong(duration).toTime(.000001), |
| 76 |
MPITYPES[sub_type], |
| 77 |
new AnInteger(msg_cnt).toString(), |
| 78 |
new AnLong(msg_bytes).toString() |
| 79 |
}; |
| 80 |
} |
| 81 |
|
| 82 |
public String[] getEventSpecificLabels() { |
| 83 |
return LABELS; |
| 84 |
} |
| 85 |
|
| 86 |
public long getDuration() { |
| 87 |
return duration; |
| 88 |
} |
| 89 |
} |