Skip to content

Commit

Permalink
rename to LlapFileSystemStatisticsData
Browse files Browse the repository at this point in the history
  • Loading branch information
abstractdog committed Nov 27, 2024
1 parent c228606 commit 83041f1
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public enum LlapExecutorCounters {
}

@VisibleForTesting
Map<String, LlapThreadLocalStatistics.StatisticsData> schemeToThreadLocalStats = new HashMap<>();
Map<String, LlapFileSystemStatisticsData> schemeToThreadLocalStats = new HashMap<>();
@VisibleForTesting
long cpuTime;
@VisibleForTesting
Expand Down Expand Up @@ -79,15 +79,15 @@ public LlapThreadLocalStatistics(ThreadMXBean mxBean, List<FileSystem.Statistics

for (FileSystem.Statistics statistics : allStatistics) {
schemeToThreadLocalStats.merge(statistics.getScheme(),
new StatisticsData(statistics.getThreadStatistics()),
new LlapFileSystemStatisticsData(statistics.getThreadStatistics()),
(statsCurrent, statsNew) -> statsCurrent.merge(statistics.getThreadStatistics()));
}
}

// This method iterates on the other LlapThreadLocalStatistics's schemes, and subtract them from this one if it's
// present here too.
public LlapThreadLocalStatistics subtract(LlapThreadLocalStatistics other) {
for (Map.Entry<String, LlapThreadLocalStatistics.StatisticsData> otherStats :
for (Map.Entry<String, LlapFileSystemStatisticsData> otherStats :
other.schemeToThreadLocalStats.entrySet()){
schemeToThreadLocalStats.computeIfPresent(otherStats.getKey(),
(thisScheme, stats) -> stats.subtract(otherStats.getValue()));
Expand All @@ -100,10 +100,10 @@ public LlapThreadLocalStatistics subtract(LlapThreadLocalStatistics other) {
}

public void fill(TezCounters tezCounters) {
for (Map.Entry<String, LlapThreadLocalStatistics.StatisticsData> threadLocalStats :
for (Map.Entry<String, LlapFileSystemStatisticsData> threadLocalStats :
schemeToThreadLocalStats.entrySet()){
String scheme = threadLocalStats.getKey();
StatisticsData stats = threadLocalStats.getValue();
LlapFileSystemStatisticsData stats = threadLocalStats.getValue();
tezCounters.findCounter(scheme, FileSystemCounter.BYTES_READ).increment(stats.bytesRead);
tezCounters.findCounter(scheme, FileSystemCounter.BYTES_WRITTEN).increment(stats.bytesWritten);
tezCounters.findCounter(scheme, FileSystemCounter.READ_OPS).increment(stats.readOps);
Expand All @@ -126,14 +126,14 @@ public String toString(){
* Unfortunately, neither the fields, nor the convenience methods (e.g. StatisticsData.add, StatisticsData.negate)
* are available here as they are package protected, so we cannot reuse them.
*/
public static class StatisticsData {
public static class LlapFileSystemStatisticsData {
long bytesRead;
long bytesWritten;
int readOps;
int largeReadOps;
int writeOps;

public StatisticsData(FileSystem.Statistics.StatisticsData fsStats) {
public LlapFileSystemStatisticsData(FileSystem.Statistics.StatisticsData fsStats) {
this.bytesRead = fsStats.getBytesRead();
this.bytesWritten = fsStats.getBytesWritten();
this.readOps = fsStats.getReadOps();
Expand All @@ -152,7 +152,7 @@ public String toString() {
return sb.toString();
}

public StatisticsData merge(FileSystem.Statistics.StatisticsData other) {
public LlapFileSystemStatisticsData merge(FileSystem.Statistics.StatisticsData other) {
this.bytesRead += other.getBytesRead();
this.bytesWritten += other.getBytesWritten();
this.readOps += other.getReadOps();
Expand All @@ -161,7 +161,7 @@ public StatisticsData merge(FileSystem.Statistics.StatisticsData other) {
return this;
}

public StatisticsData subtract(StatisticsData other) {
public LlapFileSystemStatisticsData subtract(LlapFileSystemStatisticsData other) {
if (other == null){
return this;
}
Expand Down

0 comments on commit 83041f1

Please sign in to comment.