[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>
diff --git a/runtime/tests/vm/dart/isolates/fast_object_copy_timeline_test.dart b/runtime/tests/vm/dart/isolates/fast_object_copy_timeline_test.dart
index 72b4932..f3b44b1 100644
--- a/runtime/tests/vm/dart/isolates/fast_object_copy_timeline_test.dart
+++ b/runtime/tests/vm/dart/isolates/fast_object_copy_timeline_test.dart
@@ -15,8 +15,10 @@
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<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;
}
diff --git a/runtime/tests/vm/dart_2/isolates/fast_object_copy_timeline_test.dart b/runtime/tests/vm/dart_2/isolates/fast_object_copy_timeline_test.dart
index 9030c78..b7f3c9e 100644
--- a/runtime/tests/vm/dart_2/isolates/fast_object_copy_timeline_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/fast_object_copy_timeline_test.dart
@@ -17,8 +17,10 @@
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<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;
}