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

Measure how memory is consumed by a test. #114

Merged
merged 42 commits into from
Aug 23, 2023
Merged

Conversation

polina-c
Copy link
Contributor

@polina-c polina-c commented Aug 4, 2023

Results for unit test in leak_tracker:

initialValue: 172.7 MB - 172.1 MB = 576 KB (0.33%)
deltaAvg: 49.7 MB - 49.9 MB = -266 KB (-0.52%)
deltaMax: 74.4 MB - 72.9 MB = 1.4 MB (1.97%)
absAvg: 222.4 MB - 222.1 MB = 310 KB (0.14%)
absMax: 247.1 MB - 245.1 MB = 2.0 MB (0.82%)
samples: 4245 - 4245 = 0

To set baseline, copy this code as parameter of MemoryBaselining:
      baseline: MemoryBaseline(
        rss: ValueSampler(initialValue: 181075968, deltaAvg: 52092107.835100144, deltaMax: 77987840, absAvg: 233155807.32171452, absMax: 259063808, samples: 4245,),
      )

@polina-c polina-c changed the title Measure1 Measure how memory is consumed by a test. Aug 7, 2023
@polina-c polina-c marked this pull request as ready for review August 8, 2023 14:18
@polina-c polina-c marked this pull request as draft August 8, 2023 14:19
@polina-c polina-c marked this pull request as ready for review August 17, 2023 02:01
pkgs/leak_tracker/lib/src/leak_tracking/_baseliner.dart Outdated Show resolved Hide resolved
pkgs/leak_tracker/lib/src/leak_tracking/_baseliner.dart Outdated Show resolved Hide resolved
pkgs/leak_tracker/lib/src/leak_tracking/_baseliner.dart Outdated Show resolved Hide resolved
pkgs/leak_tracker/lib/src/leak_tracking/_baseliner.dart Outdated Show resolved Hide resolved
pkgs/leak_tracker/lib/src/leak_tracking/_baseliner.dart Outdated Show resolved Hide resolved
pkgs/leak_tracker/test/tests/leak_tracking/model_test.dart Outdated Show resolved Hide resolved
Widget _materialApp({int seed = 0}) => MaterialApp(
home: SizedBox(
height:
10 + seed % 101, // We need some change to avoid constant values.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this modulo operation here? seed is in [0, 9], so this won't ever do anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method is not aware about seed size, and in future it may change. So, leaving as is.

samples: 249 - 249 = 0

To set as new baseline, set parameter of MemoryBaselining:
baseline: MemoryBaseline(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any possible way that we can include the Dart SDK version in the MemoryBaseline data? That way we can explicitly print a warning if a baseline from an older SDK is being used with a newer SDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need this issue to be resolved: flutter/flutter#61814
Added comment.

@polina-c polina-c merged commit eb6113a into dart-lang:main Aug 23, 2023
2 checks passed
@polina-c polina-c deleted the measure1 branch August 23, 2023 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants