[ Service ] Disable CPU sample block streaming

See https://github.com/dart-lang/sdk/issues/46825

TEST=vm/cc/Profiler_* and service tests

Change-Id: I98faa1953a3bf3c28828dabaa0be6b033ada63fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209260
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
diff --git a/pkg/vm_service/test/cpu_samples_stream_test.dart b/pkg/vm_service/test/cpu_samples_stream_test.dart
index d6846ef..8ef6ff6 100644
--- a/pkg/vm_service/test/cpu_samples_stream_test.dart
+++ b/pkg/vm_service/test/cpu_samples_stream_test.dart
@@ -4,7 +4,8 @@
 
 import 'dart:async';
 
-import 'package:test/test.dart';
+// TODO(bkonyi): re-import after sample streaming is fixed.
+// import 'package:test/test.dart';
 import 'package:vm_service/vm_service.dart';
 
 import 'common/service_test_common.dart';
@@ -31,7 +32,9 @@
 
 var tests = <IsolateTest>[
   (VmService service, IsolateRef isolate) async {
-    final completer = Completer<void>();
+    // TODO(bkonyi): re-enable after sample streaming is fixed.
+    // See https://github.com/dart-lang/sdk/issues/46825
+    /*final completer = Completer<void>();
     int count = 0;
     int previousOrigin = 0;
     sub = service.onProfilerEvent.listen((event) async {
@@ -56,6 +59,7 @@
 
     await completer.future;
     await service.streamCancel(EventStreams.kProfiler);
+    */
   },
 ];
 
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index 2436574..fae638f 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -306,6 +306,12 @@
   Sample* sample = nullptr;
   if (block != nullptr) {
     sample = block->ReserveSample();
+    if (sample != nullptr && block->is_full()) {
+      // TODO(bkonyi): remove once streaming is re-enabled.
+      // https://github.com/dart-lang/sdk/issues/46825
+      block->evictable_ = true;
+      FreeBlock(block);
+    }
   }
   if (sample != nullptr) {
     return sample;
@@ -330,8 +336,11 @@
     isolate->set_current_sample_block(next);
   }
   next->set_is_allocation_block(allocation_sample);
+
   can_process_block_.store(true);
-  isolate->mutator_thread()->ScheduleInterrupts(Thread::kVMInterrupt);
+  // TODO(bkonyi): re-enable after block streaming is fixed.
+  // See https://github.com/dart-lang/sdk/issues/46825
+  // isolate->mutator_thread()->ScheduleInterrupts(Thread::kVMInterrupt);
   return ReserveSampleImpl(isolate, allocation_sample);
 }