| 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.AnAddress; |
| 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 class SyncEvent extends ExtendedEvent implements DurationEvent { |
| 25 |
protected final String[] LABELS = { |
| 26 |
AnLocale.getString("Duration (msec.):"), // NOI18N |
| 27 |
AnLocale.getString("Lock Address:") // NOI18N |
| 28 |
}; |
| 29 |
|
| 30 |
public final long duration; // in nanosec |
| 31 |
public final long sobj; // synchronization object (f.e. mutex) |
| 32 |
private final String[] eventSpecificInfo; |
| 33 |
|
| 34 |
public SyncEvent( |
| 35 |
int lwpid, |
| 36 |
int thrid, |
| 37 |
int cpuid, |
| 38 |
long ts, |
| 39 |
long stack, |
| 40 |
long func, |
| 41 |
List<StackState> stackStates, |
| 42 |
long duration, |
| 43 |
long sobj, |
| 44 |
long time_adjust) { |
| 45 |
super(lwpid, thrid, cpuid, ts, stack, func, time_adjust, stackStates); |
| 46 |
|
| 47 |
this.duration = duration; |
| 48 |
this.sobj = sobj; |
| 49 |
this.eventSpecificInfo = initEventSpecificInfo(); |
| 50 |
} |
| 51 |
|
| 52 |
public String[] getEventSpecificInfo() { |
| 53 |
String[] rc = this.eventSpecificInfo.clone(); |
| 54 |
return rc; |
| 55 |
} |
| 56 |
|
| 57 |
private String[] initEventSpecificInfo() { |
| 58 |
|
| 59 |
return new String[] {new AnLong(duration).toTime(.000001), AnAddress.toHexString(sobj)}; |
| 60 |
} |
| 61 |
|
| 62 |
public String[] getEventSpecificLabels() { |
| 63 |
return LABELS; |
| 64 |
} |
| 65 |
|
| 66 |
public long getDuration() { |
| 67 |
return duration; |
| 68 |
} |
| 69 |
} |