Newer
Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
// TODO Auto-generated method stub
return Double.toString(g.getEdgeWeight(edge));
}
};
GraphMLExporter<String, DefaultEdge> exporter = new GraphMLExporter<String, DefaultEdge>(vertexIDProvider, vertexNameProvider, edgeIDProvider,
edgeLabelProvider);
Writer fileWriter;
FileWriter PS = new FileWriter(filename + ".graphml");
// gmlExporter.exportGraph(g, PS);
// FileWriter PS2 = new FileWriter(filename + "test.graphml");
exporter.exportGraph(g, PS);
}
// save graph frame in .png format
public void exportGraphAsImage(String filename) throws ExportException, IOException {
Container c = frame.getContentPane();
BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
c.paint(im.getGraphics());
ImageIO.write(im, "PNG", new File(filename + ".png"));
}
// return all vertices that can be checked for latency
// used to fill drop down
public Vector<String> getLatencyVertices() {
return allLatencyTasks;
}
public static boolean isNumeric(String strNum) {
try {
double d = Double.parseDouble(strNum);
} catch (NumberFormatException | NullPointerException nfe) {
return false;
}
return true;
}
// fill the main table of the latency frame by checking all the delay times
// between the selected tasks
public Object[][] latencyDetailedAnalysis(String task12ID, String task22ID, Vector<SimulationTransaction> transFile1) {
transFile = transFile1;
// AllDirectedPaths<String, DefaultEdge> allPaths = new AllDirectedPaths<String,
// DefaultEdge>(g);
String message = "";
String[] task1 = task12ID.split("__");
int task1index = task1.length;
idTask1 = task1[task1index - 1];
String[] task2 = task22ID.split("__");
int task2index = task2.length;
idTask2 = task2[task2index - 1];
String task12 = nameIDTaskList.get(idTask1);
String task22 = nameIDTaskList.get(idTask2);
Vector<SimulationTransaction> Task1Traces = new Vector<SimulationTransaction>();
Vector<SimulationTransaction> Task2Traces = new Vector<SimulationTransaction>();
GraphPath<String, DefaultEdge> path2 = DijkstraShortestPath.findPathBetween(g, task12, task22);
// List<GraphPath<String, DefaultEdge>> path = allPaths.getAllPaths(task12,
// task22, false, 100);
// int size = path.size();
times1.clear();
times2.clear();
// message = "there exists " +path.size()+" between: " + task12 + " and " +
// task22;
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
if (path2 != null && path2.getLength() > 0) {
for (Entry<String, ArrayList<String>> entry : channelPaths.entrySet()) {
String ChannelName = entry.getKey();
ArrayList<String> busChList = entry.getValue();
GraphPath<String, DefaultEdge> pathTochannel = DijkstraShortestPath.findPathBetween(g, task12, ChannelName);
GraphPath<String, DefaultEdge> pathFromChannel = DijkstraShortestPath.findPathBetween(g, ChannelName, task22);
if (pathTochannel != null && pathTochannel.getLength() > 0 && pathFromChannel != null && pathFromChannel.getLength() > 0) {
devicesToBeConsidered.addAll(busChList);
}
}
} else {
for (Entry<String, ArrayList<String>> entry : channelPaths.entrySet()) {
String ChannelName = entry.getKey();
ArrayList<String> busChList = entry.getValue();
GraphPath<String, DefaultEdge> pathTochannel = DijkstraShortestPath.findPathBetween(g, task12, ChannelName);
GraphPath<String, DefaultEdge> pathFromChannel = DijkstraShortestPath.findPathBetween(g, ChannelName, task22);
if ((pathTochannel != null && pathTochannel.getLength() > 0) || (pathFromChannel != null && pathFromChannel.getLength() > 0)) {
devicesToBeConsidered.addAll(busChList);
}
}
}
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
for (SimulationTransaction st : transFile1) {
if (st.id.equals(idTask1)) {
Task1Traces.add(st);
task1DeviceName = st.deviceName;
times1.add(Integer.valueOf(st.startTime));
Collections.sort(times1);
}
if (st.id.equals(idTask2)) {
Task2Traces.add(st);
task2DeviceName = st.deviceName;
times2.add(Integer.valueOf(st.endTime));
Collections.sort(times1);
}
}
// one to one
int minIndex = 0;
if (times1.size() != times2.size()) {
minIndex = Math.min(times1.size(), times2.size());
} else {
minIndex = times1.size();
}
dataByTask = new Object[minIndex][7];
dataByTaskBYRow = new Object[minIndex][2];
dataByTaskHWBYRow = new Object[minIndex][2];
for (int i = 0; i < minIndex; i++) {
HashMap<String, ArrayList<SimulationTransaction>> relatedHWs = new HashMap<String, ArrayList<SimulationTransaction>>();
HashMap<String, ArrayList<SimulationTransaction>> relatedTasks = new HashMap<String, ArrayList<SimulationTransaction>>();
relatedsimTraces = new Vector<SimulationTransaction>();
delayDueTosimTraces = new Vector<SimulationTransaction>();
runnableTimePerDevice = new HashMap<String, ArrayList<ArrayList<Integer>>>();
for (SimulationTransaction st : transFile1) {
Boolean onPath = false;
// if (Integer.valueOf(st.startTime) >= times1.get(i) &&
// Integer.valueOf(st.startTime) < times2.get(i)) {
if (!(Integer.valueOf(st.startTime) < times1.get(i) && Integer.valueOf(st.endTime) < times1.get(i))
&& !(Integer.valueOf(st.startTime) > times2.get(i) && Integer.valueOf(st.endTime) > times2.get(i))) {
// if (Integer.valueOf(st.startTime) >= minTime && Integer.valueOf(st.startTime)
// < maxTime) {
if (Integer.valueOf(st.endTime) > times2.get(i)) {
st.endTime = times2.get(i).toString();
st.length = Integer.valueOf(Integer.valueOf(times2.get(i)) - Integer.valueOf(st.startTime)).toString();
}
if (Integer.valueOf(st.startTime) < times1.get(i)) {
st.startTime = Integer.valueOf(times1.get(i)).toString();
st.length = Integer.valueOf(Integer.valueOf(st.endTime) - Integer.valueOf(times1.get(i))).toString();
}
if (Integer.valueOf(st.startTime) < times1.get(i) && Integer.valueOf(st.endTime) > times2.get(i)) {
st.startTime = Integer.valueOf(times1.get(i)).toString();
st.endTime = times2.get(i).toString();
st.length = Integer.valueOf(Integer.valueOf(times2.get(i)) - Integer.valueOf(times1.get(i))).toString();
}
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
String taskname = "";
for (String tasknameCheck : g.vertexSet()) {
String[] taskToAdd = tasknameCheck.replaceAll(" ", "").split("__");
int taskToAddindex = taskToAdd.length;
String taskToAddid = taskToAdd[taskToAddindex - 1];
if (isNumeric(taskToAddid)) {
if (Integer.valueOf(taskToAddid).equals(Integer.valueOf(st.id))) {
taskname = tasknameCheck;
break;
}
}
}
String[] name = st.deviceName.split("_");
String deviceName = name[0];
// there is a path between task 1 and task 2
if (path2 != null && path2.getLength() > 0) {
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
if (!taskname.equals(null) && !taskname.equals("")) {
GraphPath<String, DefaultEdge> pathToOrigin = DijkstraShortestPath.findPathBetween(g, task12, taskname);
GraphPath<String, DefaultEdge> pathToDestination = DijkstraShortestPath.findPathBetween(g, taskname, task22);
if (taskname.equals(task12) || taskname.equals(task22) || (pathToOrigin != null && pathToOrigin.getLength() > 0
&& pathToDestination != null && pathToDestination.getLength() > 0)) {
relatedsimTraces.add(st);
ArrayList<Integer> timeValues = new ArrayList<Integer>();
timeValues.add(0, Integer.valueOf(st.runnableTime));
timeValues.add(1, Integer.valueOf(st.startTime));
if (!(st.runnableTime).equals(st.startTime)) {
if (runnableTimePerDevice.containsKey(st.deviceName)) {
if (!runnableTimePerDevice.get(st.deviceName).contains(timeValues)) {
runnableTimePerDevice.get(st.deviceName).add(timeValues);
}
} else {
ArrayList<ArrayList<Integer>> timeValuesList = new ArrayList<ArrayList<Integer>>();
timeValuesList.add(timeValues);
runnableTimePerDevice.put(st.deviceName, timeValuesList);
}
}
}
else if (((st.deviceName.equals(task2DeviceName)) || st.deviceName.equals(task1DeviceName)
|| devicesToBeConsidered.contains(deviceName)) && !st.id.equals(idTask1) && !st.id.equals(idTask2)) {
delayDueTosimTraces.add(st);
}
}
} else {
if (!taskname.equals(null) && !taskname.equals("")) {
GraphPath<String, DefaultEdge> pathExistsTestwithTask1 = DijkstraShortestPath.findPathBetween(g, task12, taskname);
GraphPath<String, DefaultEdge> pathExistsTestwithTask2 = DijkstraShortestPath.findPathBetween(g, taskname, task22);
if (pathExistsTestwithTask1 != null && pathExistsTestwithTask1.getLength() > 0
|| pathExistsTestwithTask2 != null && pathExistsTestwithTask2.getLength() > 0) {
relatedsimTraces.add(st);
} else if (((st.deviceName.equals(task2DeviceName)) || st.deviceName.equals(task1DeviceName)
|| devicesToBeConsidered.contains(deviceName)) && !st.id.equals(idTask1) && !st.id.equals(idTask2)) {
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
delayDueTosimTraces.add(st);
}
}
}
}
}
dataByTask[i][0] = task12;
dataByTask[i][1] = times1.get(i);
dataByTask[i][2] = task22;
dataByTask[i][3] = times2.get(i);
dataByTask[i][4] = times2.get(i) - times1.get(i);
dataByTask[i][5] = "";
dataByTaskR.put(i, relatedsimTraces);
dataBydelayedTasks.put(i, delayDueTosimTraces);
timeDelayedPerRow.put(i, runnableTimePerDevice);
// dataByTask[i][5] = list.getModel();
// dataByTask[i][6] = totalTime;
}
return dataByTask;
}
// fill the detailed latency table once a row is selected
public Object[][] getTaskByRowDetails(int row) {
Object[][] dataByTaskRowDetails = new Object[dataByTaskR.get(row).size()][5];
int i = 0;
for (SimulationTransaction st : dataByTaskR.get(row)) {
dataByTaskRowDetails[i][0] = st.command;
dataByTaskRowDetails[i][1] = nameIDTaskList.get(st.id);
dataByTaskRowDetails[i][2] = st.deviceName;
dataByTaskRowDetails[i][3] = Integer.valueOf(st.startTime);
dataByTaskRowDetails[i][4] = Integer.valueOf(st.endTime);
i++;
}
return dataByTaskRowDetails;
}
// fill the detailed latency table once a row is selected
public List<SimulationTransaction> getRowDetailsTaks(int row) {
return dataByTaskR.get(row);
}
// fill the detailed latency table once a row is selected
public List<SimulationTransaction> getRowDetailsByHW(int row) {
return dataBydelayedTasks.get(row);
}
// fill the detailed latency table once a row is selected
public HashMap<String, ArrayList<ArrayList<Integer>>> getRowDelayDetailsByHW(int row) {
return timeDelayedPerRow.get(row);
}
// fill the detailed latency table once a row is selected from min/max table
public Vector<SimulationTransaction> getMinMaxTasksByRow(int row) {
return relatedsimTraces;
}
// fill the tasks that run on the same hardware but don't belong to the path
// between selected activities
public Vector<SimulationTransaction> getTaskMinMaxHWByRowDetails(int row) {
return delayDueTosimTraces;
}
// get the details of the delay for a selected min or max delay row
public void getRowDetailsMinMax(int row) {
String task12 = (String) dataByTaskMinMax[row][0];
int minTime = (int) dataByTaskMinMax[row][1];
String task22 = (String) dataByTaskMinMax[row][2];
int maxTime = (int) dataByTaskMinMax[row][3];
HashMap<String, ArrayList<SimulationTransaction>> relatedHWs = new HashMap<String, ArrayList<SimulationTransaction>>();
HashMap<String, ArrayList<SimulationTransaction>> relatedTasks = new HashMap<String, ArrayList<SimulationTransaction>>();
relatedsimTraces = new Vector<SimulationTransaction>();
delayDueTosimTraces = new Vector<SimulationTransaction>();
runnableTimePerDevice = new HashMap<String, ArrayList<ArrayList<Integer>>>();
// AllDirectedPaths<String, DefaultEdge> allPaths = new AllDirectedPaths<String,
// DefaultEdge>(g);
// List<GraphPath<String, DefaultEdge>> path = allPaths.getAllPaths(task12,
// task22, false, g.vertexSet().size());
// int size = path.size();
GraphPath<String, DefaultEdge> path2 = DijkstraShortestPath.findPathBetween(g, task12, task22);
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
if (path2 != null && path2.getLength() > 0) {
for (Entry<String, ArrayList<String>> entry : channelPaths.entrySet()) {
String ChannelName = entry.getKey();
ArrayList<String> busChList = entry.getValue();
GraphPath<String, DefaultEdge> pathTochannel = DijkstraShortestPath.findPathBetween(g, task12, ChannelName);
GraphPath<String, DefaultEdge> pathFromChannel = DijkstraShortestPath.findPathBetween(g, ChannelName, task22);
if (pathTochannel != null && pathTochannel.getLength() > 0 && pathFromChannel != null && pathFromChannel.getLength() > 0) {
devicesToBeConsidered.addAll(busChList);
}
}
} else {
for (Entry<String, ArrayList<String>> entry : channelPaths.entrySet()) {
String ChannelName = entry.getKey();
ArrayList<String> busChList = entry.getValue();
GraphPath<String, DefaultEdge> pathTochannel = DijkstraShortestPath.findPathBetween(g, task12, ChannelName);
GraphPath<String, DefaultEdge> pathFromChannel = DijkstraShortestPath.findPathBetween(g, ChannelName, task22);
if ((pathTochannel != null && pathTochannel.getLength() > 0) || (pathFromChannel != null && pathFromChannel.getLength() > 0)) {
devicesToBeConsidered.addAll(busChList);
}
}
}
for (SimulationTransaction st : transFile) {
Boolean onPath = false;
if (!(Integer.valueOf(st.startTime) < minTime && Integer.valueOf(st.endTime) < minTime)
&& !(Integer.valueOf(st.startTime) > maxTime && Integer.valueOf(st.endTime) > maxTime)) {
// if (Integer.valueOf(st.startTime) >= minTime && Integer.valueOf(st.startTime)
// < maxTime) {
if (Integer.valueOf(st.endTime) > maxTime) {
st.endTime = Integer.valueOf(maxTime).toString();
st.length = Integer.valueOf(Integer.valueOf(maxTime) - Integer.valueOf(st.startTime)).toString();
}
if (Integer.valueOf(st.startTime) < minTime) {
st.startTime = Integer.valueOf(minTime).toString();
st.length = Integer.valueOf(Integer.valueOf(st.endTime) - Integer.valueOf(minTime)).toString();
if (Integer.valueOf(st.startTime) < minTime && Integer.valueOf(st.endTime) > maxTime) {
st.startTime = Integer.valueOf(minTime).toString();
st.endTime = Integer.valueOf(maxTime).toString();
st.length = Integer.valueOf(Integer.valueOf(maxTime) - Integer.valueOf(minTime)).toString();
}
String taskname = "";
for (String tasknameCheck : g.vertexSet()) {
String[] taskToAdd = tasknameCheck.split("__");
int taskToAddindex = taskToAdd.length;
String taskToAddid = taskToAdd[taskToAddindex - 1];
if (isNumeric(taskToAddid)) {
if (Integer.valueOf(taskToAddid).equals(Integer.valueOf(st.id))) {
taskname = tasknameCheck;
break;
}
}
}
String[] name = st.deviceName.split("_");
String deviceName = name[0];
// there is a path between task 1 and task 2
if (path2 != null && path2.getLength() > 0) {
if (!taskname.equals(null) && !taskname.equals("")) {
GraphPath<String, DefaultEdge> pathToOrigin = DijkstraShortestPath.findPathBetween(g, task12, taskname);
GraphPath<String, DefaultEdge> pathToDestination = DijkstraShortestPath.findPathBetween(g, taskname, task22);
if (taskname.equals(task12) || taskname.equals(task22) || (pathToOrigin != null && pathToOrigin.getLength() > 0
&& pathToDestination != null && pathToDestination.getLength() > 0)) {
relatedsimTraces.add(st);
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
ArrayList<Integer> timeValues = new ArrayList<Integer>();
timeValues.add(0, Integer.valueOf(st.runnableTime));
timeValues.add(1, Integer.valueOf(st.startTime));
if (!(st.runnableTime).equals(st.startTime)) {
if (runnableTimePerDevice.containsKey(st.deviceName)) {
if (!runnableTimePerDevice.get(st.deviceName).contains(timeValues)) {
runnableTimePerDevice.get(st.deviceName).add(timeValues);
}
} else {
ArrayList<ArrayList<Integer>> timeValuesList = new ArrayList<ArrayList<Integer>>();
timeValuesList.add(timeValues);
runnableTimePerDevice.put(st.deviceName, timeValuesList);
}
}
else if (((st.deviceName.equals(task2DeviceName)) || st.deviceName.equals(task1DeviceName)
|| devicesToBeConsidered.contains(deviceName)) && !st.id.equals(idTask1) && !st.id.equals(idTask2)) {
delayDueTosimTraces.add(st);
}
}
timeDelayedPerRow.put(row, runnableTimePerDevice);
} else {
if (!taskname.equals(null) && !taskname.equals("")) {
GraphPath<String, DefaultEdge> pathExistsTestwithTask1 = DijkstraShortestPath.findPathBetween(g, task12, taskname);
GraphPath<String, DefaultEdge> pathExistsTestwithTask2 = DijkstraShortestPath.findPathBetween(g, taskname, task22);
if (pathExistsTestwithTask1 != null && pathExistsTestwithTask1.getLength() > 0
|| pathExistsTestwithTask2 != null && pathExistsTestwithTask2.getLength() > 0) {
relatedsimTraces.add(st);
} else if (((st.deviceName.equals(task2DeviceName)) || st.deviceName.equals(task1DeviceName)
|| devicesToBeConsidered.contains(deviceName)) && !st.id.equals(idTask1) && !st.id.equals(idTask2)) {
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
delayDueTosimTraces.add(st);
}
}
}
}
}
}
// fill the tasks that run on the same hardware but don't belong to the path
// between selected activities
public Object[][] getTaskHWByRowDetails(int row) {
Object[][] dataByTaskRowDetails = new Object[dataBydelayedTasks.get(row).size()][6];
int i = 0;
for (SimulationTransaction st : dataBydelayedTasks.get(row)) {
dataByTaskRowDetails[i][0] = st.command;
dataByTaskRowDetails[i][1] = nameIDTaskList.get(st.id);
dataByTaskRowDetails[i][2] = st.deviceName;
dataByTaskRowDetails[i][3] = Integer.valueOf(st.startTime);
dataByTaskRowDetails[i][4] = Integer.valueOf(st.endTime);
HashMap<String, ArrayList<ArrayList<Integer>>> delayTime = timeDelayedPerRow.get(row);
boolean causeDelay = false;
if (delayTime.containsKey(st.deviceName)) {
for (Entry<String, ArrayList<ArrayList<Integer>>> entry : delayTime.entrySet()) {
if (entry.getKey().equals(st.deviceName)) {
ArrayList<ArrayList<Integer>> timeList = entry.getValue();
for (int j = 0; j < timeList.size(); j++) {
if (Integer.valueOf(st.startTime) > timeList.get(j).get(0) && Integer.valueOf(st.startTime) < timeList.get(j).get(1)) {
causeDelay = true;
}
}
}
}
}
dataByTaskRowDetails[i][5] = causeDelay;
i++;
}
return dataByTaskRowDetails;
}
// fill the Min max delay table on main latency analysis frame
public Object[][] latencyMinMaxAnalysis(String task12ID, String task22ID, Vector<SimulationTransaction> transFile1) {
List<Integer> times1MinMAx = new ArrayList<Integer>();
List<Integer> times2MinMAx = new ArrayList<Integer>();
String[] task1 = task12ID.split("__");
int task1index = task1.length;
idTask1 = task1[task1index - 1];
String[] task2 = task22ID.split("__");
int task2index = task2.length;
idTask2 = task2[task2index - 1];
String task12 = nameIDTaskList.get(idTask1);
String task22 = nameIDTaskList.get(idTask2);
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
times1MinMAx = times1;
times2MinMAx = times2;
HashMap<Integer, ArrayList<Integer>> minTimes = new HashMap<Integer, ArrayList<Integer>>();
for (int time1 : times1MinMAx) {
int match = Integer.MAX_VALUE;
// Find the first subsequent transaction
int time = Integer.MAX_VALUE;
for (int time2 : times2MinMAx) {
int diff = time2 - time1;
if (diff < time && diff >= 0) {
time = diff;
match = time2;
}
}
try {
if (times2MinMAx.contains(match)) {
times2MinMAx.remove(Integer.valueOf(match));
}
} catch (Exception e) {
}
if (time != Integer.MAX_VALUE) {
ArrayList<Integer> startEndT = new ArrayList<Integer>();
startEndT.add(time1);
startEndT.add(match);
minTimes.put(time, startEndT);
}
}
dataByTaskMinMax = new Object[2][5];
if (minTimes.size() > 0) {
Integer min = Collections.min(minTimes.keySet());
Integer max = Collections.max(minTimes.keySet());
dataByTaskMinMax = new Object[2][5];
ArrayList<Integer> numMax = minTimes.get(max);
ArrayList<Integer> numMin = minTimes.get(min);
dataByTaskMinMax[0][0] = task12;
dataByTaskMinMax[0][1] = numMin.get(0);
dataByTaskMinMax[0][2] = task22;
dataByTaskMinMax[0][3] = numMin.get(1);
dataByTaskMinMax[0][4] = min;
dataByTaskMinMax[1][0] = task12;
dataByTaskMinMax[1][1] = numMax.get(0);
dataByTaskMinMax[1][2] = task22;
dataByTaskMinMax[1][3] = numMax.get(1);
dataByTaskMinMax[1][4] = max;
}
return dataByTaskMinMax;
}
// fill the detailed latency table once a row is selected from min/max table
public Object[][] getTasksByRowMinMax(int row) {
Object[][] dataByTaskRowDetails = new Object[relatedsimTraces.size()][5];
int i = 0;
for (SimulationTransaction st : relatedsimTraces) {
dataByTaskRowDetails[i][0] = st.command;
dataByTaskRowDetails[i][1] = nameIDTaskList.get(st.id);
dataByTaskRowDetails[i][2] = st.deviceName;
dataByTaskRowDetails[i][3] = Integer.valueOf(st.startTime);
dataByTaskRowDetails[i][4] = Integer.valueOf(st.endTime);
i++;
}
return dataByTaskRowDetails;
}
// fill the tasks that run on the same hardware but don't belong to the path
// between selected activities
public Object[][] getTaskHWByRowDetailsMinMax(int row) {
Object[][] dataByTaskRowDetails = new Object[delayDueTosimTraces.size()][5];
int i = 0;
for (SimulationTransaction st : delayDueTosimTraces) {
dataByTaskRowDetails[i][0] = st.command;
dataByTaskRowDetails[i][1] = nameIDTaskList.get(st.id);
dataByTaskRowDetails[i][2] = st.deviceName;
dataByTaskRowDetails[i][3] = Integer.valueOf(st.startTime);
dataByTaskRowDetails[i][4] = Integer.valueOf(st.endTime);
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
i++;
}
return dataByTaskRowDetails;
}
// import graph in .graphml format
public void importGraph(String filename) throws ExportException, IOException, ImportException {
FileReader ps = new FileReader(filename + ".graphml");
// gmlExporter.exportGraph(g, PS);
// FileWriter PS2 = new FileWriter(filename + "test.graphml");
VertexProvider<String> vertexProvider = (id, attributes) -> {
String cv = new String(id);
return cv;
};
EdgeProvider<String, DefaultEdge> edgeProvider = (from, to, label, attributes) -> new DefaultEdge();
GraphMLImporter<String, DefaultEdge> importer = new GraphMLImporter<String, DefaultEdge>(vertexProvider, edgeProvider);
Graph<String, DefaultEdge> importedGraph = null;
importer.importGraph(importedGraph, ps);
}
public List<TMLComponentDesignPanel> getCpanels() {
return cpanels;
}
public void setCpanels(List<TMLComponentDesignPanel> cpanels) {
this.cpanels = cpanels;
}