Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge package:timing #1663

Merged
merged 61 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
a330c4d
Starting timing package repo
samogot Sep 5, 2018
d6bad1f
Create timing package (dart-lang/timing#1)
samogot Sep 11, 2018
96b0b68
Release v0.1.0 (dart-lang/timing#2)
samogot Sep 11, 2018
8bd5056
add analysis_options and pkg:pedantic lints (dart-lang/timing#4)
kevmoo Sep 11, 2018
0579757
Add JSON serialization (dart-lang/timing#6)
samogot Sep 17, 2018
f889340
Release 0.1.1 (dart-lang/timing#7)
samogot Sep 18, 2018
4eb18ec
Support latest build_runner and pedantic in dev_dependencies (dart-la…
kevmoo Sep 27, 2018
7d78533
support latest pkg:json_annotation (dart-lang/timing#9)
kevmoo Oct 23, 2018
4986126
Use latest pkg:json_serializable
kevmoo Dec 10, 2018
5277da0
Fix lints
kevmoo May 10, 2019
eef2bff
Test on oldest supported SDK
kevmoo May 10, 2019
a9e09ce
Require Dart 2.2+, use latest json_serializable
kevmoo Jul 22, 2019
d4f2306
Small cleanup to description
kevmoo Jul 22, 2019
dafa868
Enable and fix a number of lints
kevmoo Jul 22, 2019
0221195
prepare next release, support latest json_annotation (dart-lang/timin…
kevmoo Aug 8, 2019
e30a22a
fix version
kevmoo Aug 8, 2019
fe5d5e4
Fix newly enforced package:pedantic lints (dart-lang/timing#13)
natebosch Dec 6, 2019
3dc7c7d
Allow the null-safe version of json_annotation (dart-lang/timing#14)
kevmoo Dec 9, 2020
c1b71a3
Migrate to GitHub Actions (dart-lang/timing#15)
athomas Jan 14, 2021
bba1fe8
Enable null-safety, prep to release v1 (dart-lang/timing#16)
kevmoo Mar 10, 2021
ccee073
Update LICENSE
franklinyow Apr 5, 2021
1cea884
Merge pull request dart-lang/timing#17 from dart-lang/franklinyow-pat…
franklinyow Apr 5, 2021
10424b0
use latest deps, drop dep overrides (dart-lang/timing#18)
kevmoo Jul 15, 2021
7e3a9d8
Update CI (dart-lang/timing#19)
kevmoo Jul 16, 2021
94086cc
Update dependencies, move to pkg:lints (dart-lang/timing#20)
kevmoo Oct 26, 2021
a36adf0
Update analysis_options.yaml (dart-lang/timing#21)
kevmoo Jul 25, 2022
2b76fa0
blast_repo fixes (dart-lang/timing#22)
kevmoo Nov 9, 2022
0825a03
Bump actions/checkout from 3.1.0 to 3.2.0 (dart-lang/timing#23)
dependabot[bot] Jan 3, 2023
7c5862d
Migrate from no-implicit-casts to strict-casts (dart-lang/timing#24)
srawlins Jan 9, 2023
72018cf
add publishing bot; rev version (dart-lang/timing#25)
devoncarew Jan 19, 2023
9b5151f
update the publishing script (dart-lang/timing#26)
devoncarew Jan 25, 2023
9f0a1bd
Bump actions/checkout from 3.2.0 to 3.3.0 (dart-lang/timing#27)
dependabot[bot] Feb 1, 2023
a611d35
Bump dart-lang/setup-dart from 1.3 to 1.4 (dart-lang/timing#28)
dependabot[bot] Feb 1, 2023
0cf059c
Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (dart-lang/timing#30)
dependabot[bot] Apr 3, 2023
e5a306e
Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/timing#29)
dependabot[bot] Apr 3, 2023
d9f85e1
Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/timing#31)
dependabot[bot] May 1, 2023
75d3989
blast_repo fixes (dart-lang/timing#32)
devoncarew May 22, 2023
7515328
Require Dart 3, update lints (dart-lang/timing#33)
kevmoo Jun 12, 2023
d9d40ee
Bump actions/checkout from 3.5.2 to 3.5.3 (dart-lang/timing#34)
dependabot[bot] Jul 1, 2023
f9ba3b2
Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/timing#35)
dependabot[bot] Sep 1, 2023
5299abb
Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (dart-lang/timing#37)
dependabot[bot] Oct 1, 2023
80518b9
Bump actions/checkout from 3.6.0 to 4.1.0 (dart-lang/timing#36)
dependabot[bot] Oct 2, 2023
672be24
Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (dart-lang/timing#39)
dependabot[bot] Nov 1, 2023
011f0f8
Bump actions/checkout from 4.1.0 to 4.1.1 (dart-lang/timing#38)
dependabot[bot] Nov 1, 2023
bded331
Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/timing#40)
dependabot[bot] Feb 1, 2024
176e080
Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/timing#41)
dependabot[bot] Apr 1, 2024
2d58436
Bump to latest lints (dart-lang/timing#42)
kevmoo Apr 10, 2024
872796e
Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/timing#43)
dependabot[bot] May 1, 2024
c249bfa
Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/timing#44)
dependabot[bot] May 1, 2024
2385bc7
blast_repo fixes (dart-lang/timing#45)
devoncarew May 10, 2024
278ea8e
Bump actions/checkout from 4.1.4 to 4.1.5 in the github-actions group…
dependabot[bot] May 10, 2024
aefae91
Bump actions/checkout from 4.1.5 to 4.1.6 in the github-actions group…
dependabot[bot] Jun 1, 2024
a6d268e
Update lints and min SDK (dart-lang/timing#48)
kevmoo Jun 26, 2024
8a64415
Bump the github-actions group with 2 updates (dart-lang/timing#49)
dependabot[bot] Jul 1, 2024
d1ebf85
Bump actions/checkout from 4.1.7 to 4.2.0 in the github-actions group…
dependabot[bot] Oct 1, 2024
07afd97
Bump actions/checkout from 4.2.0 to 4.2.2 in the github-actions group…
dependabot[bot] Nov 1, 2024
088950c
Bump dart-lang/setup-dart in the github-actions group (dart-lang/timi…
dependabot[bot] Dec 1, 2024
e87e8ce
Merge package:timing into the tools monorepo
mosuem Dec 11, 2024
3586c28
Add issue template and other fixes
mosuem Dec 11, 2024
3b69cad
Moving fixes
mosuem Dec 11, 2024
c9dedca
Add ci
mosuem Dec 11, 2024
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
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/timing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:timing"
about: "Create a bug or file a feature request against package:timing."
labels: "package:timing"
---
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@
- changed-files:
- any-glob-to-any-file: 'pkgs/sse/**'

'package:timing':
- changed-files:
- any-glob-to-any-file: 'pkgs/timing/**'

'package:unified_analytics':
- changed-files:
- any-glob-to-any-file: 'pkgs/unified_analytics/**'
67 changes: 67 additions & 0 deletions .github/workflows/timing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: package:timing

on:
# Run on PRs and pushes to the default branch.
push:
branches: [ main ]
paths:
- '.github/workflows/timing.yaml'
- 'pkgs/timing/**'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/timing.yaml'
- 'pkgs/timing/**'
schedule:
- cron: "0 0 * * 0"

env:
PUB_ENVIRONMENT: bot.github


defaults:
run:
working-directory: pkgs/timing/

jobs:
# Check code formatting and static analysis on a single OS (linux)
# against Dart dev.
analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [3.4, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
run: dart pub get
- run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
- run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'

# Run tests on a matrix consisting of two dimensions:
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
# 2. release channel: dev, 2.2.0
test:
needs: analyze
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [3.4, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
run: dart pub get
- run: dart test --platform vm
if: always() && steps.install.outcome == 'success'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ don't naturally belong to other topic monorepos (like
| [source_maps](pkgs/source_maps/) | A library to programmatically manipulate source map files. | [![package issues](https://img.shields.io/badge/package:source_maps-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Asource_maps) | [![pub package](https://img.shields.io/pub/v/source_maps.svg)](https://pub.dev/packages/source_maps) |
| [source_span](pkgs/source_span/) | Provides a standard representation for source code locations and spans. | [![package issues](https://img.shields.io/badge/package:source_span-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Asource_span) | [![pub package](https://img.shields.io/pub/v/source_span.svg)](https://pub.dev/packages/source_span) |
| [sse](pkgs/sse/) | Provides client and server functionality for setting up bi-directional communication through Server Sent Events (SSE) and corresponding POST requests. | [![package issues](https://img.shields.io/badge/package:sse-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Asse) | [![pub package](https://img.shields.io/pub/v/sse.svg)](https://pub.dev/packages/sse) |
| [timing](pkgs/timing/) | A simple package for tracking the performance of synchronous and asynchronous actions. | [![package issues](https://img.shields.io/badge/package:timing-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Atiming) | [![pub package](https://img.shields.io/pub/v/timing.svg)](https://pub.dev/packages/timing) |
| [unified_analytics](pkgs/unified_analytics/) | A package for logging analytics for all Dart and Flutter related tooling to Google Analytics. | [![package issues](https://img.shields.io/badge/package:unified_analytics-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aunified_analytics) | [![pub package](https://img.shields.io/pub/v/unified_analytics.svg)](https://pub.dev/packages/unified_analytics) |

## Publishing automation
Expand Down
7 changes: 7 additions & 0 deletions pkgs/timing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.packages
/build/
pubspec.lock

# Files generated by dart tools
.dart_tool
doc/
34 changes: 34 additions & 0 deletions pkgs/timing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## 1.0.2

- Require Dart `3.4`.
- Move to `dart-lang/tools` monorepo.

## 1.0.1

- Require Dart `2.14`.

## 1.0.0

- Enable null safety.
- Require Dart `2.12`.

## 0.1.1+3

- Allow `package:json_annotation` `'>=1.0.0 <5.0.0'`.

## 0.1.1+2

- Support the latest version of `package:json_annotation`.
- Require Dart 2.2 or later.

## 0.1.1+1

- Support the latest version of `package:json_annotation`.

## 0.1.1

- Add JSON serialization

## 0.1.0

- Initial release
27 changes: 27 additions & 0 deletions pkgs/timing/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2018, the Dart project authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 changes: 30 additions & 0 deletions pkgs/timing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[![Build Status](https://github.com/dart-lang/tools/actions/workflows/timing.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/timing.yaml)
[![pub package](https://img.shields.io/pub/v/timing.svg)](https://pub.dev/packages/timing)
[![package publisher](https://img.shields.io/pub/publisher/timing.svg)](https://pub.dev/packages/timing/publisher)

Timing is a simple package for tracking performance of both async and sync actions

## Usage

```dart
var tracker = AsyncTimeTracker();
await tracker.track(() async {
// some async code here
});

// Use results
print('${tracker.duration} ${tracker.innerDuration} ${tracker.slices}');
```

## Building

Use the following command to re-generate `lib/src/timing.g.dart` file:

```bash
dart pub run build_runner build
```

## Publishing automation

For information about our publishing automation and release process, see
https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.
2 changes: 2 additions & 0 deletions pkgs/timing/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://dart.dev/tools/analysis#the-analysis-options-file
include: package:dart_flutter_team_lints/analysis_options.yaml
20 changes: 20 additions & 0 deletions pkgs/timing/lib/src/clock.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. 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:async';

/// A function that returns the current [DateTime].
typedef _Clock = DateTime Function();
DateTime _defaultClock() => DateTime.now();

const _zoneKey = #timing_Clock;

/// Returns the current [DateTime].
///
/// May be overridden for tests using [scopeClock].
DateTime now() => (Zone.current[_zoneKey] as _Clock? ?? _defaultClock)();

/// Runs [f], with [clock] scoped whenever [now] is called.
T scopeClock<T>(DateTime Function() clock, T Function() f) =>
runZoned(f, zoneValues: {_zoneKey: clock});
Loading
Loading