Browse Source

[gardening] Make test not depend on thread-cpu-time (not available on windows)

Closes https://github.com/dart-lang/sdk/issues/49068

TEST=Fixes vm/dart_2/isolates/fast_object_copy_timeline_test on windows.

Change-Id: I85bb712df2231b41836200e0a52272f94d5cc1f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245368
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
pull/49158/head
Martin Kustermann 1 month ago
committed by Commit Bot
parent
commit
257b664c2f
  1. 21
      runtime/tests/vm/dart/isolates/fast_object_copy_timeline_test.dart
  2. 21
      runtime/tests/vm/dart_2/isolates/fast_object_copy_timeline_test.dart

21
runtime/tests/vm/dart/isolates/fast_object_copy_timeline_test.dart

@ -15,8 +15,10 @@ import 'package:expect/expect.dart';
import '../timeline_utils.dart';
final int wordSize = sizeOf<IntPtr>();
final bool useCompressedPointers =
wordSize == 8 && (Platform.isAndroid || Platform.isIOS);
final bool useCompressedPointers = wordSize == 8 &&
(Platform.isAndroid ||
Platform.isIOS ||
Platform.executable.contains('64C'));
final int kAllocationSize = 2 * wordSize;
final int headerSize = wordSize;
@ -76,32 +78,29 @@ List<ObjectCopyOperation> getCopyOperations(
List<TimelineEvent> events, String isolateId) {
final copyOperations = <ObjectCopyOperation>[];
int? startTs = null;
int? startTts = null;
TimelineEvent? start = null;
for (final e in events) {
if (e.isolateId != isolateId) continue;
if (e.name != 'CopyMutableObjectGraph') continue;
if (startTts != null) {
if (start != null) {
if (!e.isEnd) throw 'Missing end of copy event';
final us = e.ts - startTs!;
final threadUs = e.tts! - startTts;
final us = e.ts - start.ts;
final threadUs = e.tts != null ? (e.tts! - start.tts!) : 0;
copyOperations.add(ObjectCopyOperation(
us,
threadUs,
int.parse(e.args['AllocatedBytes']!),
int.parse(e.args['CopiedObjects']!)));
startTs = null;
startTts = null;
start = null;
continue;
}
if (!e.isStart) throw 'Expected end of copy event';
startTs = e.ts;
startTts = e.tts;
start = e;
}
return copyOperations;
}

21
runtime/tests/vm/dart_2/isolates/fast_object_copy_timeline_test.dart

@ -17,8 +17,10 @@ import 'package:expect/expect.dart';
import '../timeline_utils.dart';
final int wordSize = sizeOf<IntPtr>();
final bool useCompressedPointers =
wordSize == 8 && (Platform.isAndroid || Platform.isIOS);
final bool useCompressedPointers = wordSize == 8 &&
(Platform.isAndroid ||
Platform.isIOS ||
Platform.executable.contains('64C'));
final int kAllocationSize = 2 * wordSize;
final int headerSize = wordSize;
@ -78,32 +80,29 @@ List<ObjectCopyOperation> getCopyOperations(
List<TimelineEvent> events, String isolateId) {
final copyOperations = <ObjectCopyOperation>[];
int startTs = null;
int startTts = null;
TimelineEvent start = null;
for (final e in events) {
if (e.isolateId != isolateId) continue;
if (e.name != 'CopyMutableObjectGraph') continue;
if (startTts != null) {
if (start != null) {
if (!e.isEnd) throw 'Missing end of copy event';
final us = e.ts - startTs;
final threadUs = e.tts - startTts;
final us = e.ts - start.ts;
final threadUs = e.tts != null ? (e.tts - start.tts) : 0;
copyOperations.add(ObjectCopyOperation(
us,
threadUs,
int.parse(e.args['AllocatedBytes']),
int.parse(e.args['CopiedObjects'])));
startTs = null;
startTts = null;
start = null;
continue;
}
if (!e.isStart) throw 'Expected end of copy event';
startTs = e.ts;
startTts = e.tts;
start = e;
}
return copyOperations;
}

Loading…
Cancel
Save