mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 07:08:10 +08:00
Rename measure to gauge (#34)
Because the name "measure" has already been taken in pub.
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -14,8 +14,8 @@ GeneratedPluginRegistrant.m
|
|||||||
|
|
||||||
GeneratedPluginRegistrant.java
|
GeneratedPluginRegistrant.java
|
||||||
|
|
||||||
packages/measure/result.json
|
packages/gauge/result.json
|
||||||
packages/measure/resources
|
packages/gauge/resources
|
||||||
*instrumentscli*.trace
|
*instrumentscli*.trace
|
||||||
*.cipd
|
*.cipd
|
||||||
|
|
||||||
|
8
packages/gauge/CHANGELOG.md
Normal file
8
packages/gauge/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
## 0.1.1
|
||||||
|
|
||||||
|
* Improve tests and remove unnecessary resources.
|
||||||
|
|
||||||
|
## 0.1.0
|
||||||
|
|
||||||
|
* Initial release.
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
Tools for measuring some performance metrics.
|
Tools for gauging/measuring some performance metrics.
|
||||||
|
|
||||||
Currently there's only one tool to measure iOS CPU/GPU usages for Flutter's CI
|
Currently there's only one tool to measure iOS CPU/GPU usages for Flutter's CI
|
||||||
tests.
|
tests.
|
||||||
@ -12,13 +12,13 @@ your path.
|
|||||||
|
|
||||||
Finally run:
|
Finally run:
|
||||||
```shell
|
```shell
|
||||||
pub global activate measure
|
pub global activate gauge
|
||||||
```
|
```
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
Connect an iPhone, run a Flutter app on it, and
|
Connect an iPhone, run a Flutter app on it, and
|
||||||
```shell
|
```shell
|
||||||
measure ioscpugpu new
|
gauge ioscpugpu new
|
||||||
```
|
```
|
||||||
|
|
||||||
Sample output:
|
Sample output:
|
||||||
@ -28,10 +28,10 @@ gpu: 12.4%, cpu: 22.525%
|
|||||||
|
|
||||||
For more information, try
|
For more information, try
|
||||||
```shell
|
```shell
|
||||||
measure help
|
gauge help
|
||||||
measure help ioscpugpu
|
gauge help ioscpugpu
|
||||||
measure help ioscpugpu new
|
gauge help ioscpugpu new
|
||||||
measure help ioscpugpu parse
|
gauge help ioscpugpu parse
|
||||||
```
|
```
|
||||||
|
|
||||||
[1]: https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
|
[1]: https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
|
|
||||||
import 'package:measure/commands/ioscpugpu.dart';
|
import 'package:gauge/commands/ioscpugpu.dart';
|
||||||
|
|
||||||
void main(List<String> args) {
|
void main(List<String> args) {
|
||||||
final CommandRunner<void> runner = CommandRunner<void>(
|
final CommandRunner<void> runner = CommandRunner<void>(
|
||||||
'measure',
|
'gauge',
|
||||||
'Tools for measuring some performance metrics.',
|
'Tools for gauging/measuring some performance metrics.',
|
||||||
);
|
);
|
||||||
runner.addCommand(IosCpuGpu());
|
runner.addCommand(IosCpuGpu());
|
||||||
runner.run(args);
|
runner.run(args);
|
@ -1,4 +1,4 @@
|
|||||||
package: flutter/packages/measure/resources
|
package: flutter/packages/gauge/resources
|
||||||
description: Binaries and other resources for measuring performance metrics.
|
description: Binaries and other resources for measuring performance metrics.
|
||||||
install_mode: copy
|
install_mode: copy
|
||||||
data:
|
data:
|
@ -34,15 +34,15 @@ abstract class BaseCommand extends Command<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static String get defaultResourcesRoot =>
|
static String get defaultResourcesRoot =>
|
||||||
'${Platform.environment['HOME']}/.measure';
|
'${Platform.environment['HOME']}/.gauge';
|
||||||
|
|
||||||
static Future<void> doEnsureResources(String rootPath,
|
static Future<void> doEnsureResources(String rootPath,
|
||||||
{bool isVerbose}) async {
|
{bool isVerbose = false}) async {
|
||||||
final Directory root = await Directory(rootPath).create(recursive: true);
|
final Directory root = await Directory(rootPath).create(recursive: true);
|
||||||
final Directory previous = Directory.current;
|
final Directory previous = Directory.current;
|
||||||
Directory.current = root;
|
Directory.current = root;
|
||||||
final File ensureFile = File('ensure_file.txt');
|
final File ensureFile = File('ensure_file.txt');
|
||||||
ensureFile.writeAsStringSync('flutter/packages/measure/resources latest');
|
ensureFile.writeAsStringSync('flutter/packages/gauge/resources latest');
|
||||||
if (isVerbose) {
|
if (isVerbose) {
|
||||||
print('Downloading resources from CIPD...');
|
print('Downloading resources from CIPD...');
|
||||||
}
|
}
|
@ -3,8 +3,8 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:measure/commands/ioscpugpu/new.dart';
|
import 'package:gauge/commands/ioscpugpu/new.dart';
|
||||||
import 'package:measure/commands/ioscpugpu/parse.dart';
|
import 'package:gauge/commands/ioscpugpu/parse.dart';
|
||||||
|
|
||||||
class IosCpuGpu extends Command<void> {
|
class IosCpuGpu extends Command<void> {
|
||||||
IosCpuGpu() {
|
IosCpuGpu() {
|
@ -5,8 +5,8 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:measure/commands/base.dart';
|
import 'package:gauge/commands/base.dart';
|
||||||
import 'package:measure/parser.dart';
|
import 'package:gauge/parser.dart';
|
||||||
|
|
||||||
class IosCpuGpuNew extends IosCpuGpuSubcommand {
|
class IosCpuGpuNew extends IosCpuGpuSubcommand {
|
||||||
IosCpuGpuNew() {
|
IosCpuGpuNew() {
|
@ -4,22 +4,21 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:measure/commands/base.dart';
|
import 'package:gauge/commands/base.dart';
|
||||||
import 'package:measure/parser.dart';
|
import 'package:gauge/parser.dart';
|
||||||
|
|
||||||
class IosCpuGpuParse extends IosCpuGpuSubcommand {
|
class IosCpuGpuParse extends IosCpuGpuSubcommand {
|
||||||
@override
|
@override
|
||||||
String get name => 'parse';
|
String get name => 'parse';
|
||||||
@override
|
@override
|
||||||
String get description =>
|
String get description =>
|
||||||
'parse an existing instruments trace with CPU/GPU measurements.';
|
'Parse an existing instruments trace with CPU/GPU measurements.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get usage {
|
String get usage {
|
||||||
final List<String> lines = super.usage.split('\n');
|
return super.usage.split('\n').map((String line) {
|
||||||
lines[0] = 'Usage: measure ioscpugpu -u <trace-utility-path> '
|
return line + (line.startsWith('Usage:') ? ' <trace-file-path>' : '');
|
||||||
'parse <trace-file-path>';
|
}).join('\n');
|
||||||
return lines.join('\n');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
@ -1,11 +1,11 @@
|
|||||||
name: measure
|
name: gauge
|
||||||
description: Tools for measuring some performance metrics.
|
description: Tools for gauging/measuring some performance metrics.
|
||||||
author: Flutter Team <flutter-dev@googlegroups.com>
|
author: Flutter Team <flutter-dev@googlegroups.com>
|
||||||
homepage: https://github.com/flutter/packages/tree/master/packages/measure
|
homepage: https://github.com/flutter/packages/tree/master/packages/gauge
|
||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
|
|
||||||
executables:
|
executables:
|
||||||
measure: measure
|
gauge: gauge
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
args: ^1.5.2
|
args: ^1.5.2
|
40
packages/gauge/test/gauge_general_test.dart
Normal file
40
packages/gauge/test/gauge_general_test.dart
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
final String gaugeRootPath = Directory.current.absolute.path;
|
||||||
|
|
||||||
|
test('help works', () {
|
||||||
|
final ProcessResult result = Process.runSync(
|
||||||
|
'dart',
|
||||||
|
<String>['$gaugeRootPath/bin/gauge.dart', 'help'],
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
result.stdout.toString(),
|
||||||
|
contains(
|
||||||
|
'Tools for gauging/measuring some performance metrics.',
|
||||||
|
));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ioscpugpu parse help works', () {
|
||||||
|
final ProcessResult result = Process.runSync(
|
||||||
|
'dart',
|
||||||
|
<String>['$gaugeRootPath/bin/gauge.dart', 'ioscpugpu', 'parse'],
|
||||||
|
);
|
||||||
|
final String help = result.stdout.toString();
|
||||||
|
expect(
|
||||||
|
help.split('\n')[0],
|
||||||
|
equals('Parse an existing instruments trace with CPU/GPU measurements.'),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
help,
|
||||||
|
contains('Usage: gauge ioscpugpu parse [arguments] <trace-file-path>'),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
@ -8,30 +8,18 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
import 'package:measure/commands/base.dart';
|
import 'package:gauge/commands/base.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
const String measureRootPath = '.';
|
final String gaugeRootPath = Directory.current.absolute.path;
|
||||||
final String resourcesRootPath = BaseCommand.defaultResourcesRoot;
|
final String resourcesRootPath = BaseCommand.defaultResourcesRoot;
|
||||||
BaseCommand.doEnsureResources(resourcesRootPath, isVerbose: true);
|
BaseCommand.doEnsureResources(resourcesRootPath);
|
||||||
|
|
||||||
test('help works', () {
|
|
||||||
final ProcessResult result = Process.runSync(
|
|
||||||
'dart',
|
|
||||||
<String>['$measureRootPath/bin/measure.dart', 'help'],
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
result.stdout.toString(),
|
|
||||||
contains(
|
|
||||||
'Tools for measuring some performance metrics.',
|
|
||||||
));
|
|
||||||
});
|
|
||||||
|
|
||||||
ProcessResult _testIosCpuGpu(List<String> extraArgs) {
|
ProcessResult _testIosCpuGpu(List<String> extraArgs) {
|
||||||
return Process.runSync(
|
return Process.runSync(
|
||||||
'dart',
|
'dart',
|
||||||
<String>[
|
<String>[
|
||||||
'$measureRootPath/bin/measure.dart',
|
'$gaugeRootPath/bin/gauge.dart',
|
||||||
'ioscpugpu',
|
'ioscpugpu',
|
||||||
...extraArgs,
|
...extraArgs,
|
||||||
'-r',
|
'-r',
|
@ -1,4 +0,0 @@
|
|||||||
## 0.1.0
|
|
||||||
|
|
||||||
* Initial release.
|
|
||||||
|
|
Reference in New Issue
Block a user