Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/gauge/lib/commands/ioscpugpu/new.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'dart:io';
import 'package:gauge/commands/base.dart';
import 'package:gauge/parser.dart';

/// See also: [IosCpuGpu]
class IosCpuGpuNew extends IosCpuGpuSubcommand {
IosCpuGpuNew() {
argParser.addOption(
Expand Down
1 change: 1 addition & 0 deletions packages/gauge/lib/commands/ioscpugpu/parse.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'dart:async';
import 'package:gauge/commands/base.dart';
import 'package:gauge/parser.dart';

/// See also: [IosCpuGpu]
class IosCpuGpuParse extends IosCpuGpuSubcommand {
@override
String get name => 'parse';
Expand Down
10 changes: 10 additions & 0 deletions packages/gauge/lib/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import 'dart:convert';
import 'dart:io';

/// Class that represents the CPU and GPU usage percentage.
///
/// See also: [IosTraceParser.parseCpuGpu]
class CpuGpuResult {
CpuGpuResult(this.gpuPercentage, this.cpuPercentage);

Expand All @@ -25,7 +28,12 @@ class CpuGpuResult {
}
}

/// Parser that distills the output from TraceUtility.
///
/// See also: https://github.com/Qusic/TraceUtility
class IosTraceParser {
/// Creates a [IosTraceParser] that runs the TraceUtility executable at
/// [traceUtilityPath], verbosely if [isVerbose] is true.
IosTraceParser(this.isVerbose, this.traceUtilityPath);

final bool isVerbose;
Expand All @@ -35,6 +43,8 @@ class IosTraceParser {
List<String> _gpuMeasurements;
List<String> _cpuMeasurements;

/// Runs TraceUtility on the file at [filename] and parses the output for the
/// process named [processName] that is needed for [CpuGpuResult].
CpuGpuResult parseCpuGpu(String filename, String processName) {
final ProcessResult result = Process.runSync(
traceUtilityPath,
Expand Down