no message

This commit is contained in:
2025-05-10 17:15:45 +03:00
parent e1291446c8
commit c148f62198
11 changed files with 86 additions and 62 deletions

View File

@@ -0,0 +1,12 @@
package _VisualDVM.ProjectData.SapforData.Regions;
import Common.Utils.IntegerPairJson;
import com.google.gson.annotations.Expose;
import java.util.List;
import java.util.Vector;
public class FileRegionLinesJson {
@Expose
public String file;
@Expose
public List<IntegerPairJson> lines = new Vector<>();
}

View File

@@ -1,6 +1,7 @@
package _VisualDVM.ProjectData.SapforData.Regions;
import Common.Database.Objects.DBObject;
import Common.Utils.Index;
import Common.Utils.IntegerPairJson;
import Common.Utils.Pair;
import Common.Utils.Utils_;
import _VisualDVM.Global;
@@ -8,18 +9,30 @@ import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.AlignRule;
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.DataDirective;
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
import com.google.gson.annotations.Expose;
import java.math.BigInteger;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Vector;
public class ParallelRegion extends DBObject {
//json
@Expose
public String packed_region_id;
@Expose
public String originalName;
@Expose
public List<ProjectArray> arrays=new Vector<>();
@Expose
public RegionLinesJson packed_lines;
//--
public BigInteger regionId;
//name in program
public String originalName;
// file -> <start, end> lines
public LinkedHashMap<String, Vector<Pair<Integer, Integer>>> lines;
public LinkedHashMap<String, List<IntegerPairJson>> lines;
//ключ - адрес. меняем
public LinkedHashMap<BigInteger, ProjectArray> arrays;
public LinkedHashMap<BigInteger, ProjectArray> arraysMap;
//for directive creating
public DataDirective dataDirectives;
public int maxdim = 0;
@@ -30,9 +43,8 @@ public class ParallelRegion extends DBObject {
public int fd_count = 0;
public int fc_count = 0;
public ParallelRegion(String[] splited, Index idx) {
// regionId = Long.parseLong(splited[idx.Inc()]);
regionId = new BigInteger(splited[idx.Inc()]);
originalName = splited[idx.Inc()];
regionId = new BigInteger(splited[idx.Inc()]);//+
originalName = splited[idx.Inc()];//+
String[] localSplited = splited[idx.Inc()].split("\\|");
int lines_size = Integer.parseInt(localSplited[0]);
lines = new LinkedHashMap<>(lines_size);
@@ -41,25 +53,24 @@ public class ParallelRegion extends DBObject {
for (int i = 0; i < lines_size; ++i) {
String line_file = Utils_.toW(localSplited[1]);
int line_list_size = Integer.parseInt(localSplited[2]);
Vector<Pair<Integer, Integer>> current_lines = new Vector<>(line_list_size);
Vector<IntegerPairJson> current_lines = new Vector<>(line_list_size);
for (int k = 0; k < line_list_size; ++k) {
int first = Integer.parseInt(splited[idx.Inc()]);
if (first == 0) first++;
localSplited = splited[idx.Inc()].split("\\|");
int second = Integer.parseInt((localSplited[0]));
current_lines.add(new Pair<>(first, second));
current_lines.add(new IntegerPairJson(first, second));
fragments.add(line_file + ": " + first + "-" + second);
}
lines.put(line_file, current_lines);
}
maxdim = 0;
int arrays_size = Integer.parseInt(splited[idx.Inc()]);
arrays = new LinkedHashMap<>(arrays_size);
arraysMap = new LinkedHashMap<>(arrays_size);
for (int i = 0; i < arrays_size; ++i) {
//long array_address = Long.parseLong((splited[idx.Inc()]));
BigInteger array_address = new BigInteger((splited[idx.Inc()]));
ProjectArray new_array = new ProjectArray(splited, idx, array_address);
arrays.put(array_address, new_array);
arraysMap.put(array_address, new_array);
//-------------------------------------------------------
if (new_array.isTemplFlag == 1) {
maxdim = Math.max(maxdim, new_array.dimSize);
@@ -80,7 +91,7 @@ public class ParallelRegion extends DBObject {
fd_count = 0;
fc_count = 0;
for (String FKey : lines.keySet()) {
for (Pair<Integer, Integer> L : lines.get(FKey)) {
for (IntegerPairJson L : lines.get(FKey)) {
lines_count += (L.getValue() - L.getKey());
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
loops_count += f.FragmentLoopCount(L.getKey(), L.getValue());
@@ -91,10 +102,10 @@ public class ParallelRegion extends DBObject {
//--------------------------------------------------
}
public boolean ArrayBelongsToRegion(long id) {
return arrays.values().stream().anyMatch(array -> array.id == id);
return arraysMap.values().stream().anyMatch(array -> array.id == id);
}
public ProjectArray getArrayById(long id) {
for (ProjectArray array : arrays.values()) {
for (ProjectArray array : arraysMap.values()) {
if (array.id == id) return array;
}
return null;
@@ -110,7 +121,7 @@ public class ParallelRegion extends DBObject {
public void UpdateLoopsCount() {
loops_count = 0;
for (String FKey : lines.keySet()) {
for (Pair<Integer, Integer> L : lines.get(FKey)) {
for (IntegerPairJson L : lines.get(FKey)) {
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
loops_count += f.FragmentLoopCount(L.getKey(), L.getValue());
}
@@ -120,7 +131,7 @@ public class ParallelRegion extends DBObject {
fd_count = 0;
fc_count = 0;
for (String FKey : lines.keySet()) {
for (Pair<Integer, Integer> L : lines.get(FKey)) {
for (IntegerPairJson L : lines.get(FKey)) {
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
fc_count += f.FragmentFunctionCallsCount(L.getKey(), L.getValue());
fd_count += f.FragmentFunctionDeclsCount(L.getKey(), L.getValue());
@@ -130,17 +141,10 @@ public class ParallelRegion extends DBObject {
public void UpdateArraysCount() {
arrays_count = 0;
for (String FKey : lines.keySet()) {
for (Pair<Integer, Integer> L : lines.get(FKey)) {
for (IntegerPairJson L : lines.get(FKey)) {
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
arrays_count += f.FragmentArraysCount(L.getKey(), L.getValue());
}
}
/*
if (new_array.isTemplFlag == 1) {
maxdim = Math.max(maxdim, new_array.dimSize);
Current.getProject().templates.put(new_array.address, new_array);
new_array.regIDs.add(regionId);
} else if (new_array.isLoopArrayFlag != 1) arrays_count++;
*/
}
}

View File

@@ -0,0 +1,9 @@
package _VisualDVM.ProjectData.SapforData.Regions;
import com.google.gson.annotations.Expose;
import java.util.List;
import java.util.Vector;
public class RegionLinesJson {
@Expose
public List<FileRegionLinesJson> allLines = new Vector<>();
}

View File

@@ -0,0 +1,9 @@
package _VisualDVM.ProjectData.SapforData.Regions;
import com.google.gson.annotations.Expose;
import java.util.List;
import java.util.Vector;
public class RegionsJson {
@Expose
public List<ParallelRegion> allRegions = new Vector<>();
}