Skip to content

Commit

Permalink
Adjust ranges to the max for all gpufreq tracks; (#1163)
Browse files Browse the repository at this point in the history
Visualize GPU frequencies from different counters with a shared maximum range value.
Add hs_err_pid* log java runtime files to the ignore list;
  • Loading branch information
kocdemir authored Aug 2, 2022
1 parent 5f9db5c commit 4b522c5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*ycm_extra_conf.py*
gapir.log
gapis.log
hs_err_pid*.log

# MacOS
.DS_Store
Expand Down
41 changes: 38 additions & 3 deletions gapic/src/main/com/google/gapid/perfetto/models/CounterInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.gapid.models.Perfetto;
import com.google.gapid.perfetto.Unit;
import com.google.gapid.proto.device.GpuProfiling;
import com.google.gapid.util.Range;

import java.util.List;
import java.util.Objects;
import java.util.logging.Logger;

Expand Down Expand Up @@ -108,7 +110,7 @@ public class CounterInfo {
public final Range range;

public CounterInfo(long id, Type type, long ref, String name, String description, Unit unit,
Interpolation interpolation, long count, double min, double max, double avg) {
Interpolation interpolation, long count, double min, double max, double avg, Range range) {
this.id = id;
this.type = type;
this.ref = ref;
Expand All @@ -120,7 +122,14 @@ public CounterInfo(long id, Type type, long ref, String name, String description
this.min = min;
this.max = max;
this.avg = avg;
this.range = computeRange(unit, min, max);
this.range = range;
}

public CounterInfo(long id, Type type, long ref, String name, String description, Unit unit,
Interpolation interpolation, long count, double min, double max, double avg) {

this(id, type, ref, name, description, unit,
interpolation, count, min, max, avg, computeRange(unit, min, max));
}

private CounterInfo(QueryEngine.Row row) {
Expand Down Expand Up @@ -177,7 +186,33 @@ public static ListenableFuture<Perfetto.Data.Builder> listCounters(Perfetto.Data
return transformAsync(listCounterGroups(data), $1 -> transform(
data.qe.query(LIST_SQL), res -> {
ImmutableMap.Builder<Long, CounterInfo> counters = ImmutableMap.builder();
res.forEachRow((i, r) -> counters.put(r.getLong(0), new CounterInfo(r)));
List<CounterInfo> gpufreqCounters = Lists.newArrayList();
res.forEachRow(
(i, r) ->
{
CounterInfo newCounter = new CounterInfo(r);
// Save references to "gpufreq" counters for range adjustment
if ("gpufreq".equals(newCounter.name))
gpufreqCounters.add(newCounter);
else
counters.put(newCounter.id, newCounter);
}
);

// Use maximum range for gpufreq counters to visualize them with correct proportion to each other.
if (gpufreqCounters.size() > 0) {
double gpufreqMax = 0;
for (CounterInfo c : gpufreqCounters) {
gpufreqMax = Math.max(gpufreqMax, c.max);
}
for (CounterInfo c : gpufreqCounters) {
CounterInfo newCounter = new CounterInfo(c.id, c.type, c.ref, c.name,
c.description, c.unit, c.interpolation, c.count, c.min, c.max, c.avg,
computeRange(c.unit, c.min, gpufreqMax));
counters.put(newCounter.id, newCounter);
}
}

return data.setCounters(counters.build());
}));
}
Expand Down

0 comments on commit 4b522c5

Please sign in to comment.