mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 07:31:43 +00:00
[vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service. Change-Id: Ia0d4e1ca252604e8fcef466a31e3d2a8b0912251 Reviewed-on: https://dart-review.googlesource.com/c/90100 Reviewed-by: Zach Anderson <zra@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
2faab1d4c0
commit
06a1e6e9e3
|
@ -16,26 +16,24 @@ namespace dart {
|
|||
// Native implementations for the dart:developer library.
|
||||
|
||||
DEFINE_NATIVE_ENTRY(Timeline_isDartStreamEnabled, 0, 0) {
|
||||
#ifndef PRODUCT
|
||||
if (!FLAG_support_timeline) {
|
||||
return Bool::False().raw();
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
if (Timeline::GetDartStream()->enabled()) {
|
||||
return Bool::True().raw();
|
||||
}
|
||||
#endif // !PRODUCT
|
||||
#endif
|
||||
return Bool::False().raw();
|
||||
}
|
||||
|
||||
DEFINE_NATIVE_ENTRY(Timeline_getNextAsyncId, 0, 0) {
|
||||
if (!FLAG_support_timeline) {
|
||||
return Integer::New(0);
|
||||
}
|
||||
#if !defined(SUPPORT_TIMELINE)
|
||||
return Integer::New(0);
|
||||
#else
|
||||
TimelineEventRecorder* recorder = Timeline::recorder();
|
||||
if (recorder == NULL) {
|
||||
return Integer::New(0);
|
||||
}
|
||||
return Integer::New(recorder->GetNextAsyncId());
|
||||
#endif
|
||||
}
|
||||
|
||||
DEFINE_NATIVE_ENTRY(Timeline_getTraceClock, 0, 0) {
|
||||
|
@ -47,10 +45,7 @@ DEFINE_NATIVE_ENTRY(Timeline_getThreadCpuClock, 0, 0) {
|
|||
}
|
||||
|
||||
DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 0, 6) {
|
||||
#ifndef PRODUCT
|
||||
if (!FLAG_support_timeline) {
|
||||
return Object::null();
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(Integer, id, arguments->NativeArgAt(1));
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(String, phase, arguments->NativeArgAt(2));
|
||||
|
@ -72,15 +67,12 @@ DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 0, 6) {
|
|||
DartTimelineEventHelpers::ReportTaskEvent(
|
||||
thread, event, start.AsInt64Value(), id.AsInt64Value(), phase.ToCString(),
|
||||
category.ToCString(), name.ToMallocCString(), args.ToMallocCString());
|
||||
#endif
|
||||
#endif // SUPPORT_TIMELINE
|
||||
return Object::null();
|
||||
}
|
||||
|
||||
DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 0, 5) {
|
||||
#ifndef PRODUCT
|
||||
if (!FLAG_support_timeline) {
|
||||
return Object::null();
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(Integer, start_cpu, arguments->NativeArgAt(1));
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(2));
|
||||
|
@ -101,15 +93,12 @@ DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 0, 5) {
|
|||
DartTimelineEventHelpers::ReportCompleteEvent(
|
||||
thread, event, start.AsInt64Value(), start_cpu.AsInt64Value(),
|
||||
category.ToCString(), name.ToMallocCString(), args.ToMallocCString());
|
||||
#endif // !defined(PRODUCT)
|
||||
#endif // SUPPORT_TIMELINE
|
||||
return Object::null();
|
||||
}
|
||||
|
||||
DEFINE_NATIVE_ENTRY(Timeline_reportFlowEvent, 0, 7) {
|
||||
#ifndef PRODUCT
|
||||
if (!FLAG_support_timeline) {
|
||||
return Object::null();
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(Integer, start_cpu, arguments->NativeArgAt(1));
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(2));
|
||||
|
@ -133,15 +122,12 @@ DEFINE_NATIVE_ENTRY(Timeline_reportFlowEvent, 0, 7) {
|
|||
thread, event, start.AsInt64Value(), start_cpu.AsInt64Value(),
|
||||
category.ToCString(), name.ToMallocCString(), type.AsInt64Value(),
|
||||
flow_id.AsInt64Value(), args.ToMallocCString());
|
||||
#endif // !defined(PRODUCT)
|
||||
#endif // SUPPORT_TIMELINE
|
||||
return Object::null();
|
||||
}
|
||||
|
||||
DEFINE_NATIVE_ENTRY(Timeline_reportInstantEvent, 0, 4) {
|
||||
#ifndef PRODUCT
|
||||
if (!FLAG_support_timeline) {
|
||||
return Object::null();
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(1));
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2));
|
||||
|
@ -161,7 +147,7 @@ DEFINE_NATIVE_ENTRY(Timeline_reportInstantEvent, 0, 4) {
|
|||
DartTimelineEventHelpers::ReportInstantEvent(
|
||||
thread, event, start.AsInt64Value(), category.ToCString(),
|
||||
name.ToMallocCString(), args.ToMallocCString());
|
||||
#endif
|
||||
#endif // SUPPORT_TIMELINE
|
||||
return Object::null();
|
||||
}
|
||||
|
||||
|
|
|
@ -172,8 +172,7 @@ static void CollectImmediateSuperInterfaces(const Class& cls,
|
|||
// b) after the user classes are loaded (dart_api).
|
||||
bool ClassFinalizer::ProcessPendingClasses() {
|
||||
Thread* thread = Thread::Current();
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(thread, Timeline::GetIsolateStream(),
|
||||
"ProcessPendingClasses"));
|
||||
TIMELINE_DURATION(thread, Isolate, "ProcessPendingClasses");
|
||||
Isolate* isolate = thread->isolate();
|
||||
ASSERT(isolate != NULL);
|
||||
HANDLESCOPE(thread);
|
||||
|
@ -1127,10 +1126,7 @@ void ClassFinalizer::FinalizeClass(const Class& cls) {
|
|||
THR_Print("Finalize %s\n", cls.ToCString());
|
||||
}
|
||||
|
||||
#if !defined(PRODUCT)
|
||||
TimelineDurationScope tds(thread, Timeline::GetCompilerStream(),
|
||||
"ClassFinalizer::FinalizeClass");
|
||||
#endif // !defined(PRODUCT)
|
||||
TIMELINE_DURATION(thread, Compiler, "ClassFinalizer::FinalizeClass");
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
// If loading from a kernel, make sure that the class is fully loaded.
|
||||
|
|
|
@ -597,8 +597,7 @@ class FunctionDeserializationCluster : public DeserializationCluster {
|
|||
}
|
||||
|
||||
void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) {
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(
|
||||
Thread::Current(), Timeline::GetIsolateStream(), "PostLoadFunction"));
|
||||
TIMELINE_DURATION(Thread::Current(), Isolate, "PostLoadFunction");
|
||||
|
||||
if (kind == Snapshot::kFullAOT) {
|
||||
Function& func = Function::Handle(zone);
|
||||
|
@ -1011,8 +1010,7 @@ class FieldDeserializationCluster : public DeserializationCluster {
|
|||
}
|
||||
|
||||
void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) {
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(
|
||||
Thread::Current(), Timeline::GetIsolateStream(), "PostLoadField"));
|
||||
TIMELINE_DURATION(Thread::Current(), Isolate, "PostLoadField");
|
||||
|
||||
Field& field = Field::Handle(zone);
|
||||
if (!Isolate::Current()->use_field_guards()) {
|
||||
|
@ -3285,8 +3283,7 @@ class MintDeserializationCluster : public DeserializationCluster {
|
|||
void ReadFill(Deserializer* d) {}
|
||||
|
||||
void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) {
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(
|
||||
Thread::Current(), Timeline::GetIsolateStream(), "PostLoadMint"));
|
||||
TIMELINE_DURATION(Thread::Current(), Isolate, "PostLoadMint");
|
||||
|
||||
const Class& mint_cls =
|
||||
Class::Handle(zone, Isolate::Current()->object_store()->mint_class());
|
||||
|
@ -5107,8 +5104,7 @@ void Deserializer::Deserialize() {
|
|||
}
|
||||
|
||||
{
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(
|
||||
thread(), Timeline::GetIsolateStream(), "ReadAlloc"));
|
||||
TIMELINE_DURATION(thread(), Isolate, "ReadAlloc");
|
||||
for (intptr_t i = 0; i < num_clusters_; i++) {
|
||||
clusters_[i] = ReadCluster();
|
||||
clusters_[i]->ReadAlloc(this);
|
||||
|
@ -5123,8 +5119,7 @@ void Deserializer::Deserialize() {
|
|||
ASSERT((next_ref_index_ - 1) == num_objects_);
|
||||
|
||||
{
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(
|
||||
thread(), Timeline::GetIsolateStream(), "ReadFill"));
|
||||
TIMELINE_DURATION(thread(), Isolate, "ReadFill");
|
||||
for (intptr_t i = 0; i < num_clusters_; i++) {
|
||||
clusters_[i]->ReadFill(this);
|
||||
#if defined(DEBUG)
|
||||
|
@ -5422,8 +5417,7 @@ FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind,
|
|||
// generated from a VM that has loaded this snapshots, much like app-jit
|
||||
// snapshots.
|
||||
if ((vm_snapshot_data_buffer != NULL) && (kind != Snapshot::kFullAOT)) {
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(
|
||||
thread(), Timeline::GetIsolateStream(), "PrepareNewVMIsolate"));
|
||||
TIMELINE_DURATION(thread(), Isolate, "PrepareNewVMIsolate");
|
||||
|
||||
SeedVMIsolateVisitor visitor(thread()->zone(),
|
||||
Snapshot::IncludesCode(kind));
|
||||
|
@ -5464,8 +5458,7 @@ FullSnapshotWriter::~FullSnapshotWriter() {
|
|||
}
|
||||
|
||||
intptr_t FullSnapshotWriter::WriteVMSnapshot() {
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(
|
||||
thread(), Timeline::GetIsolateStream(), "WriteVMSnapshot"));
|
||||
TIMELINE_DURATION(thread(), Isolate, "WriteVMSnapshot");
|
||||
|
||||
ASSERT(vm_snapshot_data_buffer_ != NULL);
|
||||
Serializer serializer(thread(), kind_, vm_snapshot_data_buffer_, alloc_,
|
||||
|
@ -5498,8 +5491,7 @@ intptr_t FullSnapshotWriter::WriteVMSnapshot() {
|
|||
}
|
||||
|
||||
void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) {
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(
|
||||
thread(), Timeline::GetIsolateStream(), "WriteIsolateSnapshot"));
|
||||
TIMELINE_DURATION(thread(), Isolate, "WriteIsolateSnapshot");
|
||||
|
||||
Serializer serializer(thread(), kind_, isolate_snapshot_data_buffer_, alloc_,
|
||||
kInitialSize, isolate_image_writer_, /*vm=*/false,
|
||||
|
|
|
@ -2311,10 +2311,8 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
|
|||
|
||||
{
|
||||
ic_data_array = new (zone) ZoneGrowableArray<const ICData*>();
|
||||
#ifndef PRODUCT
|
||||
TimelineDurationScope tds(thread(), compiler_timeline,
|
||||
"BuildFlowGraph");
|
||||
#endif // !PRODUCT
|
||||
|
||||
TIMELINE_DURATION(thread(), Compiler, "BuildFlowGraph");
|
||||
flow_graph =
|
||||
pipeline->BuildFlowGraph(zone, parsed_function(), ic_data_array,
|
||||
Compiler::kNoOSRDeoptId, optimized());
|
||||
|
@ -2342,10 +2340,7 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
|
|||
NOT_IN_PRODUCT(pass_state.compiler_timeline = compiler_timeline);
|
||||
|
||||
if (optimized()) {
|
||||
#ifndef PRODUCT
|
||||
TimelineDurationScope tds(thread(), compiler_timeline,
|
||||
"OptimizationPasses");
|
||||
#endif // !PRODUCT
|
||||
TIMELINE_DURATION(thread(), Compiler, "OptimizationPasses");
|
||||
|
||||
pass_state.inline_id_to_function.Add(&function);
|
||||
// We do not add the token position now because we don't know the
|
||||
|
@ -2389,17 +2384,12 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
|
|||
pass_state.inline_id_to_token_pos, pass_state.caller_inline_id,
|
||||
ic_data_array, function_stats);
|
||||
{
|
||||
#ifndef PRODUCT
|
||||
TimelineDurationScope tds(thread(), compiler_timeline, "CompileGraph");
|
||||
#endif // !PRODUCT
|
||||
TIMELINE_DURATION(thread(), Compiler, "CompileGraph");
|
||||
graph_compiler.CompileGraph();
|
||||
pipeline->FinalizeCompilation(flow_graph);
|
||||
}
|
||||
{
|
||||
#ifndef PRODUCT
|
||||
TimelineDurationScope tds(thread(), compiler_timeline,
|
||||
"FinalizeCompilation");
|
||||
#endif // !PRODUCT
|
||||
TIMELINE_DURATION(thread(), Compiler, "FinalizeCompilation");
|
||||
ASSERT(thread()->IsMutatorThread());
|
||||
FinalizeCompilation(&assembler, &graph_compiler, flow_graph,
|
||||
function_stats);
|
||||
|
|
|
@ -40,12 +40,7 @@ static void TraceStrongModeType(const Instruction* instr,
|
|||
}
|
||||
|
||||
void FlowGraphTypePropagator::Propagate(FlowGraph* flow_graph) {
|
||||
#ifndef PRODUCT
|
||||
Thread* thread = flow_graph->thread();
|
||||
TimelineStream* compiler_timeline = Timeline::GetCompilerStream();
|
||||
TimelineDurationScope tds2(thread, compiler_timeline,
|
||||
"FlowGraphTypePropagator");
|
||||
#endif // !PRODUCT
|
||||
TIMELINE_DURATION(flow_graph->thread(), Compiler, "FlowGraphTypePropagator");
|
||||
FlowGraphTypePropagator propagator(flow_graph);
|
||||
propagator.Propagate();
|
||||
}
|
||||
|
|
|
@ -173,8 +173,7 @@ void CompilerPass::Run(CompilerPassState* state) const {
|
|||
|
||||
PrintGraph(state, kTraceBefore, round);
|
||||
{
|
||||
NOT_IN_PRODUCT(
|
||||
TimelineDurationScope tds2(thread, state->compiler_timeline, name()));
|
||||
TIMELINE_DURATION(thread, Compiler, name());
|
||||
repeat = DoBody(state);
|
||||
DEBUG_ASSERT(state->flow_graph->VerifyUseLists());
|
||||
thread->CheckForSafepoint();
|
||||
|
|
|
@ -44,7 +44,7 @@ bool BytecodeMetadataHelper::HasBytecode(intptr_t node_offset) {
|
|||
}
|
||||
|
||||
void BytecodeMetadataHelper::ReadMetadata(const Function& function) {
|
||||
#if !defined(PRODUCT)
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
TimelineDurationScope tds(Thread::Current(), Timeline::GetCompilerStream(),
|
||||
"BytecodeMetadataHelper::ReadMetadata");
|
||||
// This increases bytecode reading time by ~7%, so only keep it around for
|
||||
|
@ -310,10 +310,8 @@ void BytecodeMetadataHelper::ReadTypeParametersDeclaration(
|
|||
|
||||
void BytecodeMetadataHelper::ReadConstantPool(const Function& function,
|
||||
const ObjectPool& pool) {
|
||||
#if !defined(PRODUCT)
|
||||
TimelineDurationScope tds(Thread::Current(), Timeline::GetCompilerStream(),
|
||||
"BytecodeMetadataHelper::ReadConstantPool");
|
||||
#endif // !defined(PRODUCT)
|
||||
TIMELINE_DURATION(Thread::Current(), Compiler,
|
||||
"BytecodeMetadataHelper::ReadConstantPool");
|
||||
|
||||
// These enums and the code below reading the constant pool from kernel must
|
||||
// be kept in sync with pkg/vm/lib/bytecode/constant_pool.dart.
|
||||
|
@ -638,10 +636,8 @@ void BytecodeMetadataHelper::ReadConstantPool(const Function& function,
|
|||
}
|
||||
|
||||
RawBytecode* BytecodeMetadataHelper::ReadBytecode(const ObjectPool& pool) {
|
||||
#if !defined(PRODUCT)
|
||||
TimelineDurationScope tds(Thread::Current(), Timeline::GetCompilerStream(),
|
||||
"BytecodeMetadataHelper::ReadBytecode");
|
||||
#endif // !defined(PRODUCT)
|
||||
TIMELINE_DURATION(Thread::Current(), Compiler,
|
||||
"BytecodeMetadataHelper::ReadBytecode");
|
||||
intptr_t size = helper_->ReadUInt();
|
||||
intptr_t offset = Utils::RoundUp(helper_->reader_.offset(), sizeof(KBCInstr));
|
||||
const uint8_t* data = helper_->reader_.BufferAt(offset);
|
||||
|
@ -659,10 +655,8 @@ RawBytecode* BytecodeMetadataHelper::ReadBytecode(const ObjectPool& pool) {
|
|||
|
||||
void BytecodeMetadataHelper::ReadExceptionsTable(const Bytecode& bytecode,
|
||||
bool has_exceptions_table) {
|
||||
#if !defined(PRODUCT)
|
||||
TimelineDurationScope tds(Thread::Current(), Timeline::GetCompilerStream(),
|
||||
"BytecodeMetadataHelper::ReadExceptionsTable");
|
||||
#endif // !defined(PRODUCT)
|
||||
TIMELINE_DURATION(Thread::Current(), Compiler,
|
||||
"BytecodeMetadataHelper::ReadExceptionsTable");
|
||||
|
||||
const intptr_t try_block_count =
|
||||
has_exceptions_table ? helper_->reader_.ReadListLength() : 0;
|
||||
|
|
|
@ -2227,10 +2227,10 @@ void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler,
|
|||
|
||||
void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler,
|
||||
Label* normal_ir_body) {
|
||||
if (!FLAG_support_timeline) {
|
||||
__ LoadObject(R0, Bool::False());
|
||||
__ Ret();
|
||||
}
|
||||
#if !defined(SUPPORT_TIMELINE)
|
||||
__ LoadObject(R0, Bool::False());
|
||||
__ Ret();
|
||||
#else
|
||||
// Load TimelineStream*.
|
||||
__ ldr(R0, Address(THR, Thread::dart_stream_offset()));
|
||||
// Load uintptr_t from TimelineStream*.
|
||||
|
@ -2239,6 +2239,7 @@ void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler,
|
|||
__ LoadObject(R0, Bool::True(), NE);
|
||||
__ LoadObject(R0, Bool::False(), EQ);
|
||||
__ Ret();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Intrinsifier::ClearAsyncThreadStackTrace(Assembler* assembler,
|
||||
|
|
|
@ -2288,10 +2288,10 @@ void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler,
|
|||
|
||||
void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler,
|
||||
Label* normal_ir_body) {
|
||||
if (!FLAG_support_timeline) {
|
||||
__ LoadObject(R0, Bool::False());
|
||||
__ ret();
|
||||
}
|
||||
#if !defined(SUPPORT_TIMELINE)
|
||||
__ LoadObject(R0, Bool::False());
|
||||
__ ret();
|
||||
#else
|
||||
// Load TimelineStream*.
|
||||
__ ldr(R0, Address(THR, Thread::dart_stream_offset()));
|
||||
// Load uintptr_t from TimelineStream*.
|
||||
|
@ -2301,6 +2301,7 @@ void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler,
|
|||
__ LoadObject(TMP, Bool::True());
|
||||
__ csel(R0, TMP, R0, NE);
|
||||
__ ret();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Intrinsifier::ClearAsyncThreadStackTrace(Assembler* assembler,
|
||||
|
|
|
@ -2202,10 +2202,10 @@ void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler,
|
|||
|
||||
void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler,
|
||||
Label* normal_ir_body) {
|
||||
if (!FLAG_support_timeline) {
|
||||
__ LoadObject(EAX, Bool::False());
|
||||
__ ret();
|
||||
}
|
||||
#if !defined(SUPPORT_TIMELINE)
|
||||
__ LoadObject(EAX, Bool::False());
|
||||
__ ret();
|
||||
#else
|
||||
Label true_label;
|
||||
// Load TimelineStream*.
|
||||
__ movl(EAX, Address(THR, Thread::dart_stream_offset()));
|
||||
|
@ -2220,6 +2220,7 @@ void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler,
|
|||
__ Bind(&true_label);
|
||||
__ LoadObject(EAX, Bool::True());
|
||||
__ ret();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Intrinsifier::ClearAsyncThreadStackTrace(Assembler* assembler,
|
||||
|
|
|
@ -2229,11 +2229,10 @@ void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler,
|
|||
|
||||
void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler,
|
||||
Label* normal_ir_body) {
|
||||
if (!FLAG_support_timeline) {
|
||||
__ LoadObject(RAX, Bool::False());
|
||||
__ ret();
|
||||
return;
|
||||
}
|
||||
#if !defined(SUPPORT_TIMELINE)
|
||||
__ LoadObject(RAX, Bool::False());
|
||||
__ ret();
|
||||
#else
|
||||
Label true_label;
|
||||
// Load TimelineStream*.
|
||||
__ movq(RAX, Address(THR, Thread::dart_stream_offset()));
|
||||
|
@ -2248,6 +2247,7 @@ void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler,
|
|||
__ Bind(&true_label);
|
||||
__ LoadObject(RAX, Bool::True());
|
||||
__ ret();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Intrinsifier::ClearAsyncThreadStackTrace(Assembler* assembler,
|
||||
|
|
|
@ -619,8 +619,7 @@ RawCode* CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
|
|||
}
|
||||
}
|
||||
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), compiler_timeline,
|
||||
"BuildFlowGraph"));
|
||||
TIMELINE_DURATION(thread(), Compiler, "BuildFlowGraph");
|
||||
flow_graph = pipeline->BuildFlowGraph(
|
||||
zone, parsed_function(), ic_data_array, osr_id(), optimized());
|
||||
}
|
||||
|
@ -638,8 +637,8 @@ RawCode* CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
|
|||
const bool reorder_blocks =
|
||||
FlowGraph::ShouldReorderBlocks(function, optimized());
|
||||
if (reorder_blocks) {
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(
|
||||
thread(), compiler_timeline, "BlockScheduler::AssignEdgeWeights"));
|
||||
TIMELINE_DURATION(thread(), Compiler,
|
||||
"BlockScheduler::AssignEdgeWeights");
|
||||
block_scheduler.AssignEdgeWeights();
|
||||
}
|
||||
|
||||
|
@ -649,8 +648,7 @@ RawCode* CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
|
|||
pass_state.reorder_blocks = reorder_blocks;
|
||||
|
||||
if (optimized()) {
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), compiler_timeline,
|
||||
"OptimizationPasses"));
|
||||
TIMELINE_DURATION(thread(), Compiler, "OptimizationPasses");
|
||||
|
||||
pass_state.inline_id_to_function.Add(&function);
|
||||
// We do not add the token position now because we don't know the
|
||||
|
@ -677,14 +675,12 @@ RawCode* CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
|
|||
pass_state.inline_id_to_token_pos, pass_state.caller_inline_id,
|
||||
ic_data_array);
|
||||
{
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), compiler_timeline,
|
||||
"CompileGraph"));
|
||||
TIMELINE_DURATION(thread(), Compiler, "CompileGraph");
|
||||
graph_compiler.CompileGraph();
|
||||
pipeline->FinalizeCompilation(flow_graph);
|
||||
}
|
||||
{
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), compiler_timeline,
|
||||
"FinalizeCompilation"));
|
||||
TIMELINE_DURATION(thread(), Compiler, "FinalizeCompilation");
|
||||
if (thread()->IsMutatorThread()) {
|
||||
*result =
|
||||
FinalizeCompilation(&assembler, &graph_compiler, flow_graph);
|
||||
|
@ -1205,7 +1201,7 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
|
|||
// it now, but don't bother remembering it because it won't be used again.
|
||||
ASSERT(!field.HasPrecompiledInitializer());
|
||||
{
|
||||
#if !defined(PRODUCT)
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId);
|
||||
TimelineDurationScope tds(thread, Timeline::GetCompilerStream(),
|
||||
"CompileStaticInitializer");
|
||||
|
|
|
@ -164,11 +164,10 @@ char* Dart::Init(const uint8_t* vm_isolate_snapshot,
|
|||
start_time_micros_ = OS::GetCurrentMonotonicMicros();
|
||||
VirtualMemory::Init();
|
||||
OSThread::Init();
|
||||
if (FLAG_support_timeline) {
|
||||
Timeline::Init();
|
||||
}
|
||||
NOT_IN_PRODUCT(
|
||||
TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::Init"));
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
Timeline::Init();
|
||||
TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::Init");
|
||||
#endif
|
||||
Isolate::InitVM();
|
||||
PortMap::Init();
|
||||
FreeListElement::Init();
|
||||
|
@ -214,8 +213,9 @@ char* Dart::Init(const uint8_t* vm_isolate_snapshot,
|
|||
ArgumentsDescriptor::Init();
|
||||
ICData::Init();
|
||||
if (vm_isolate_snapshot != NULL) {
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(Timeline::GetVMStream(),
|
||||
"VMIsolateSnapshot"));
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
TimelineDurationScope tds(Timeline::GetVMStream(), "VMIsolateSnapshot");
|
||||
#endif
|
||||
const Snapshot* snapshot = Snapshot::SetupFromBuffer(vm_isolate_snapshot);
|
||||
if (snapshot == NULL) {
|
||||
return strdup("Invalid vm isolate snapshot seen");
|
||||
|
@ -260,7 +260,7 @@ char* Dart::Init(const uint8_t* vm_isolate_snapshot,
|
|||
ReversePcLookupCache::BuildAndAttachToIsolate(vm_isolate_);
|
||||
|
||||
Object::FinishInit(vm_isolate_);
|
||||
#if !defined(PRODUCT)
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
if (tds.enabled()) {
|
||||
tds.SetNumArguments(2);
|
||||
tds.FormatArgument(0, "snapshotSize", "%" Pd, snapshot->length());
|
||||
|
@ -309,8 +309,9 @@ char* Dart::Init(const uint8_t* vm_isolate_snapshot,
|
|||
}
|
||||
#endif
|
||||
{
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(Timeline::GetVMStream(),
|
||||
"FinalizeVMIsolate"));
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
TimelineDurationScope tds(Timeline::GetVMStream(), "FinalizeVMIsolate");
|
||||
#endif
|
||||
Object::FinalizeVMIsolate(vm_isolate_);
|
||||
}
|
||||
#if defined(DEBUG)
|
||||
|
@ -526,13 +527,13 @@ char* Dart::Cleanup() {
|
|||
UptimeMillis());
|
||||
}
|
||||
NOT_IN_PRODUCT(CodeObservers::Cleanup());
|
||||
if (FLAG_support_timeline) {
|
||||
if (FLAG_trace_shutdown) {
|
||||
OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down timeline\n",
|
||||
UptimeMillis());
|
||||
}
|
||||
Timeline::Cleanup();
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
if (FLAG_trace_shutdown) {
|
||||
OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down timeline\n",
|
||||
UptimeMillis());
|
||||
}
|
||||
Timeline::Cleanup();
|
||||
#endif
|
||||
OS::Cleanup();
|
||||
if (FLAG_trace_shutdown) {
|
||||
OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done\n", UptimeMillis());
|
||||
|
@ -571,16 +572,17 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data,
|
|||
// Initialize the new isolate.
|
||||
Thread* T = Thread::Current();
|
||||
Isolate* I = T->isolate();
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(),
|
||||
"InitializeIsolate");
|
||||
tds.SetNumArguments(1);
|
||||
tds.CopyArgument(0, "isolateName", I->name());)
|
||||
#if defined(SUPPORT_TIMLINE)
|
||||
TimelineDurationScope tds(T, Timeline::GetIsolateStream(),
|
||||
"InitializeIsolate");
|
||||
tds.SetNumArguments(1);
|
||||
tds.CopyArgument(0, "isolateName", I->name());
|
||||
#endif
|
||||
ASSERT(I != NULL);
|
||||
StackZone zone(T);
|
||||
HandleScope handle_scope(T);
|
||||
{
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(),
|
||||
"ObjectStore::Init"));
|
||||
TIMELINE_DURATION(T, Isolate, "ObjectStore::Init");
|
||||
ObjectStore::Init(I);
|
||||
}
|
||||
|
||||
|
@ -591,8 +593,10 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data,
|
|||
}
|
||||
if ((snapshot_data != NULL) && kernel_buffer == NULL) {
|
||||
// Read the snapshot and setup the initial state.
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(),
|
||||
"IsolateSnapshotReader"));
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
TimelineDurationScope tds(T, Timeline::GetIsolateStream(),
|
||||
"IsolateSnapshotReader");
|
||||
#endif
|
||||
// TODO(turnidge): Remove once length is not part of the snapshot.
|
||||
const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_data);
|
||||
if (snapshot == NULL) {
|
||||
|
@ -618,7 +622,7 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data,
|
|||
|
||||
ReversePcLookupCache::BuildAndAttachToIsolate(I);
|
||||
|
||||
#if !defined(PRODUCT)
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
if (tds.enabled()) {
|
||||
tds.SetNumArguments(2);
|
||||
tds.FormatArgument(0, "snapshotSize", "%" Pd, snapshot->length());
|
||||
|
|
|
@ -4729,6 +4729,14 @@ RawString* Api::GetEnvironmentValue(Thread* thread, const String& name) {
|
|||
#endif
|
||||
}
|
||||
|
||||
if (name.Equals(Symbols::DartDeveloperTimeline())) {
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
return Symbols::True().raw();
|
||||
#else
|
||||
return Symbols::False().raw();
|
||||
#endif
|
||||
}
|
||||
|
||||
const String& prefix = Symbols::DartLibrary();
|
||||
if (name.StartsWith(prefix)) {
|
||||
const String& library_name =
|
||||
|
@ -5655,9 +5663,7 @@ DART_EXPORT bool Dart_IsReloading() {
|
|||
}
|
||||
|
||||
DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) {
|
||||
if (!FLAG_support_timeline) {
|
||||
return;
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
const bool api_enabled = (stream_mask & DART_TIMELINE_STREAM_API) != 0;
|
||||
const bool compiler_enabled =
|
||||
(stream_mask & DART_TIMELINE_STREAM_COMPILER) != 0;
|
||||
|
@ -5678,6 +5684,7 @@ DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) {
|
|||
Timeline::SetStreamGCEnabled(gc_enabled);
|
||||
Timeline::SetStreamIsolateEnabled(isolate_enabled);
|
||||
Timeline::SetStreamVMEnabled(vm_enabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void StartStreamToConsumer(Dart_StreamConsumer consumer,
|
||||
|
@ -5758,18 +5765,17 @@ static bool StreamTraceEvents(Dart_StreamConsumer consumer,
|
|||
DART_EXPORT void Dart_SetEmbedderTimelineCallbacks(
|
||||
Dart_EmbedderTimelineStartRecording start_recording,
|
||||
Dart_EmbedderTimelineStopRecording stop_recording) {
|
||||
if (!FLAG_support_timeline) {
|
||||
return;
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
Timeline::set_start_recording_cb(start_recording);
|
||||
Timeline::set_stop_recording_cb(stop_recording);
|
||||
#endif
|
||||
}
|
||||
|
||||
DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer,
|
||||
void* user_data) {
|
||||
if (!FLAG_support_timeline) {
|
||||
return false;
|
||||
}
|
||||
#if defined(PRODUCT)
|
||||
return false;
|
||||
#else
|
||||
// To support various embedders, it must be possible to call this function
|
||||
// from a thread for which we have not entered an Isolate and set up a Thread
|
||||
// TLS object. Therefore, a Zone may not be available, a StackZone cannot be
|
||||
|
@ -5793,6 +5799,7 @@ DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer,
|
|||
}
|
||||
FinishStreamToConsumer(consumer, user_data, "timeline");
|
||||
return success;
|
||||
#endif
|
||||
}
|
||||
|
||||
DART_EXPORT void Dart_TimelineEvent(const char* label,
|
||||
|
@ -5802,9 +5809,7 @@ DART_EXPORT void Dart_TimelineEvent(const char* label,
|
|||
intptr_t argument_count,
|
||||
const char** argument_names,
|
||||
const char** argument_values) {
|
||||
if (!FLAG_support_timeline) {
|
||||
return;
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
if (type < Dart_Timeline_Event_Begin) {
|
||||
return;
|
||||
}
|
||||
|
@ -5861,6 +5866,7 @@ DART_EXPORT void Dart_TimelineEvent(const char* label,
|
|||
event->CopyArgument(i, argument_names[i], argument_values[i]);
|
||||
}
|
||||
event->Complete();
|
||||
#endif
|
||||
}
|
||||
#endif // defined(PRODUCT)
|
||||
|
||||
|
@ -6019,8 +6025,7 @@ Dart_CreateAppAOTSnapshotAsAssembly(Dart_StreamingWriteCallback callback,
|
|||
ASSERT(FLAG_load_deferred_eagerly);
|
||||
CHECK_NULL(callback);
|
||||
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
|
||||
"WriteAppAOTSnapshot"));
|
||||
TIMELINE_DURATION(T, Isolate, "WriteAppAOTSnapshot");
|
||||
AssemblyImageWriter image_writer(T, callback, callback_data, NULL, NULL);
|
||||
uint8_t* vm_snapshot_data_buffer = NULL;
|
||||
uint8_t* isolate_snapshot_data_buffer = NULL;
|
||||
|
@ -6052,8 +6057,7 @@ Dart_CreateVMAOTSnapshotAsAssembly(Dart_StreamingWriteCallback callback,
|
|||
API_TIMELINE_DURATION(T);
|
||||
CHECK_NULL(callback);
|
||||
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
|
||||
"WriteVMAOTSnapshot"));
|
||||
TIMELINE_DURATION(T, Isolate, "WriteVMAOTSnapshot");
|
||||
AssemblyImageWriter image_writer(T, callback, callback_data, NULL, NULL);
|
||||
uint8_t* vm_snapshot_data_buffer = NULL;
|
||||
FullSnapshotWriter writer(Snapshot::kFullAOT, &vm_snapshot_data_buffer, NULL,
|
||||
|
@ -6108,8 +6112,7 @@ Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer,
|
|||
}
|
||||
const void* shared_instructions_image = shared_instructions;
|
||||
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
|
||||
"WriteAppAOTSnapshot"));
|
||||
TIMELINE_DURATION(T, Isolate, "WriteAppAOTSnapshot");
|
||||
BlobImageWriter vm_image_writer(T, vm_snapshot_instructions_buffer,
|
||||
ApiReallocate, 2 * MB /* initial_size */,
|
||||
/*shared_objects=*/nullptr,
|
||||
|
@ -6220,8 +6223,7 @@ DART_EXPORT Dart_Handle Dart_CreateCoreJITSnapshotAsBlobs(
|
|||
ProgramVisitor::Dedup();
|
||||
Symbols::Compact(I);
|
||||
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
|
||||
"WriteCoreJITSnapshot"));
|
||||
TIMELINE_DURATION(T, Isolate, "WriteCoreJITSnapshot");
|
||||
BlobImageWriter vm_image_writer(T, vm_snapshot_instructions_buffer,
|
||||
ApiReallocate, 2 * MB /* initial_size */,
|
||||
/*shared_objects=*/nullptr,
|
||||
|
@ -6289,8 +6291,7 @@ Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
|
|||
DumpTypeArgumentsTable(I);
|
||||
}
|
||||
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
|
||||
"WriteAppJITSnapshot"));
|
||||
TIMELINE_DURATION(T, Isolate, "WriteAppJITSnapshot");
|
||||
BlobImageWriter isolate_image_writer(T, isolate_snapshot_instructions_buffer,
|
||||
ApiReallocate, 2 * MB /* initial_size */,
|
||||
/*shared_objects=*/nullptr,
|
||||
|
|
|
@ -102,7 +102,7 @@ const char* CanonicalFunction(const char* func);
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
#define API_TIMELINE_DURATION(thread) \
|
||||
TimelineDurationScope tds(thread, Timeline::GetAPIStream(), CURRENT_FUNC)
|
||||
#define API_TIMELINE_DURATION_BASIC(thread) \
|
||||
|
|
|
@ -3111,8 +3111,7 @@ void Debugger::Pause(ServiceEvent* event) {
|
|||
{
|
||||
Thread* thread = Thread::Current();
|
||||
DisableThreadInterruptsScope dtis(thread);
|
||||
TimelineDurationScope tds(thread, Timeline::GetDebuggerStream(),
|
||||
"Debugger Pause");
|
||||
TIMELINE_DURATION(thread, Debugger, "Debugger Pause");
|
||||
|
||||
// Send the pause event.
|
||||
Service::HandleEvent(event);
|
||||
|
|
|
@ -155,8 +155,9 @@ DeoptContext::~DeoptContext() {
|
|||
delete[] deferred_objects_;
|
||||
deferred_objects_ = NULL;
|
||||
deferred_objects_count_ = 0;
|
||||
#ifndef PRODUCT
|
||||
if (FLAG_support_timeline && (deopt_start_micros_ != 0)) {
|
||||
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
if (deopt_start_micros_ != 0) {
|
||||
TimelineStream* compiler_stream = Timeline::GetCompilerStream();
|
||||
ASSERT(compiler_stream != NULL);
|
||||
if (compiler_stream->enabled()) {
|
||||
|
|
|
@ -161,7 +161,6 @@ constexpr bool kDartPrecompiledRuntime = false;
|
|||
R(support_il_printer, false, bool, true, "Support the IL printer.") \
|
||||
C(support_reload, false, false, bool, true, "Support isolate reload.") \
|
||||
R(support_service, false, bool, true, "Support the service protocol.") \
|
||||
R(support_timeline, false, bool, true, "Support timeline.") \
|
||||
D(trace_cha, bool, false, "Trace CHA operations") \
|
||||
R(trace_field_guards, false, bool, false, "Trace changes in field's cids.") \
|
||||
D(trace_ic, bool, false, "Trace IC handling") \
|
||||
|
|
|
@ -73,6 +73,10 @@ const intptr_t kDefaultMaxOldGenHeapSize = (kWordSize <= 4) ? 1536 : 0;
|
|||
#define NOT_IN_PRECOMPILED(code) code
|
||||
#endif // defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
||||
#if !defined(PRODUCT) || defined(HOST_OS_FUCHSIA) || defined(TARGET_OS_FUCHSIA)
|
||||
#define SUPPORT_TIMELINE 1
|
||||
#endif
|
||||
|
||||
#if defined(ARCH_IS_64_BIT)
|
||||
#define HASH_IN_OBJECT_HEADER 1
|
||||
#endif
|
||||
|
|
|
@ -293,7 +293,9 @@ void CompactorTask::Run() {
|
|||
bool result =
|
||||
Thread::EnterIsolateAsHelper(isolate_, Thread::kCompactorTask, true);
|
||||
ASSERT(result);
|
||||
NOT_IN_PRODUCT(Thread* thread = Thread::Current());
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
Thread* thread = Thread::Current();
|
||||
#endif
|
||||
{
|
||||
{
|
||||
TIMELINE_FUNCTION_GC_DURATION(thread, "Plan");
|
||||
|
|
|
@ -603,7 +603,9 @@ void Scavenger::IterateObjectIdTable(Isolate* isolate,
|
|||
}
|
||||
|
||||
void Scavenger::IterateRoots(Isolate* isolate, ScavengerVisitor* visitor) {
|
||||
NOT_IN_PRODUCT(Thread* thread = Thread::Current());
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
Thread* thread = Thread::Current();
|
||||
#endif
|
||||
int64_t start = OS::GetCurrentMonotonicMicros();
|
||||
{
|
||||
TIMELINE_FUNCTION_GC_DURATION(thread, "ProcessRoots");
|
||||
|
|
|
@ -281,8 +281,7 @@ void ImageWriter::Write(WriteStream* clustered_stream, bool vm) {
|
|||
Thread* thread = Thread::Current();
|
||||
Zone* zone = thread->zone();
|
||||
Heap* heap = thread->isolate()->heap();
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(thread, Timeline::GetIsolateStream(),
|
||||
"WriteInstructions"));
|
||||
TIMELINE_DURATION(thread, Isolate, "WriteInstructions");
|
||||
|
||||
// Handlify collected raw pointers as building the names below
|
||||
// will allocate on the Dart heap.
|
||||
|
|
|
@ -496,7 +496,7 @@ MessageHandler::MessageStatus IsolateMessageHandler::HandleMessage(
|
|||
StackZone stack_zone(thread);
|
||||
Zone* zone = stack_zone.GetZone();
|
||||
HandleScope handle_scope(thread);
|
||||
#ifndef PRODUCT
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
TimelineDurationScope tds(
|
||||
thread, Timeline::GetIsolateStream(),
|
||||
message->IsOOB() ? "HandleOOBMessage" : "HandleMessage");
|
||||
|
@ -1359,16 +1359,16 @@ const char* Isolate::MakeRunnable() {
|
|||
ASSERT(this == state->isolate());
|
||||
Run();
|
||||
}
|
||||
#ifndef PRODUCT
|
||||
if (FLAG_support_timeline) {
|
||||
TimelineStream* stream = Timeline::GetIsolateStream();
|
||||
ASSERT(stream != NULL);
|
||||
TimelineEvent* event = stream->StartEvent();
|
||||
if (event != NULL) {
|
||||
event->Instant("Runnable");
|
||||
event->Complete();
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
TimelineStream* stream = Timeline::GetIsolateStream();
|
||||
ASSERT(stream != NULL);
|
||||
TimelineEvent* event = stream->StartEvent();
|
||||
if (event != NULL) {
|
||||
event->Instant("Runnable");
|
||||
event->Complete();
|
||||
}
|
||||
#endif
|
||||
#ifndef PRODUCT
|
||||
if (FLAG_support_service && !Isolate::IsVMInternalIsolate(this) &&
|
||||
Service::isolate_stream.enabled()) {
|
||||
ServiceEvent runnableEvent(this, ServiceEvent::kIsolateRunnable);
|
||||
|
@ -1812,15 +1812,15 @@ void Isolate::LowLevelShutdown() {
|
|||
// Fail fast if anybody tries to post any more messages to this isolate.
|
||||
delete message_handler();
|
||||
set_message_handler(NULL);
|
||||
if (FLAG_support_timeline) {
|
||||
// Before analyzing the isolate's timeline blocks- reclaim all cached
|
||||
// blocks.
|
||||
Timeline::ReclaimCachedBlocksFromThreads();
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
// Before analyzing the isolate's timeline blocks- reclaim all cached
|
||||
// blocks.
|
||||
Timeline::ReclaimCachedBlocksFromThreads();
|
||||
#endif
|
||||
|
||||
// Dump all timing data for the isolate.
|
||||
#ifndef PRODUCT
|
||||
if (FLAG_support_timeline && FLAG_timing) {
|
||||
#if defined(SUPPORT_TIMELINE) && !defined(PRODUCT)
|
||||
if (FLAG_timing) {
|
||||
TimelinePauseTrace tpt;
|
||||
tpt.Print();
|
||||
}
|
||||
|
|
|
@ -71,9 +71,9 @@ class RunKernelTask : public ThreadPool::Task {
|
|||
public:
|
||||
virtual void Run() {
|
||||
ASSERT(Isolate::Current() == NULL);
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
TimelineDurationScope tds(Timeline::GetVMStream(), "KernelIsolateStartup");
|
||||
#endif // !PRODUCT
|
||||
#endif // SUPPORT_TIMELINE
|
||||
char* error = NULL;
|
||||
Isolate* isolate = NULL;
|
||||
|
||||
|
|
|
@ -1300,8 +1300,7 @@ RawError* Object::Init(Isolate* isolate,
|
|||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
const bool is_kernel = (kernel_buffer != NULL);
|
||||
#endif
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(thread, Timeline::GetIsolateStream(),
|
||||
"Object::Init");)
|
||||
TIMELINE_DURATION(thread, Isolate, "Object::Init");
|
||||
|
||||
#if defined(DART_NO_SNAPSHOT)
|
||||
bool bootstrapping =
|
||||
|
|
|
@ -29,7 +29,7 @@ OSThread::OSThread()
|
|||
#if defined(DEBUG)
|
||||
join_id_(kInvalidThreadJoinId),
|
||||
#endif
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
trace_id_(OSThread::GetCurrentThreadTraceId()),
|
||||
#endif
|
||||
name_(NULL),
|
||||
|
@ -75,11 +75,11 @@ OSThread::~OSThread() {
|
|||
RemoveThreadFromList(this);
|
||||
delete log_;
|
||||
log_ = NULL;
|
||||
if (FLAG_support_timeline) {
|
||||
if (Timeline::recorder() != NULL) {
|
||||
Timeline::recorder()->FinishBlock(timeline_block_);
|
||||
}
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
if (Timeline::recorder() != NULL) {
|
||||
Timeline::recorder()->FinishBlock(timeline_block_);
|
||||
}
|
||||
#endif
|
||||
timeline_block_ = NULL;
|
||||
delete timeline_block_lock_;
|
||||
free(name_);
|
||||
|
|
|
@ -69,7 +69,7 @@ class OSThread : public BaseThread {
|
|||
return id_;
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
ThreadId trace_id() const {
|
||||
ASSERT(trace_id_ != OSThread::kInvalidThreadId);
|
||||
return trace_id_;
|
||||
|
@ -230,7 +230,7 @@ class OSThread : public BaseThread {
|
|||
void set_thread(ThreadState* value) { thread_ = value; }
|
||||
|
||||
static void Cleanup();
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
static ThreadId GetCurrentThreadTraceId();
|
||||
#endif // PRODUCT
|
||||
static OSThread* GetOSThreadFromThread(ThreadState* thread);
|
||||
|
@ -246,7 +246,7 @@ class OSThread : public BaseThread {
|
|||
// only called once per OSThread.
|
||||
ThreadJoinId join_id_;
|
||||
#endif
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
const ThreadId trace_id_; // Used to interface with tracing tools.
|
||||
#endif
|
||||
char* name_; // A name for this thread.
|
||||
|
|
|
@ -187,7 +187,7 @@ ThreadId OSThread::GetCurrentThreadId() {
|
|||
return gettid();
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
ThreadId OSThread::GetCurrentThreadTraceId() {
|
||||
return GetCurrentThreadId();
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ ThreadId OSThread::GetCurrentThreadId() {
|
|||
return info.koid;
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
ThreadId OSThread::GetCurrentThreadTraceId() {
|
||||
return pthread_self();
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ ThreadId OSThread::GetCurrentThreadId() {
|
|||
return pthread_self();
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
ThreadId OSThread::GetCurrentThreadTraceId() {
|
||||
return syscall(__NR_gettid);
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ ThreadId OSThread::GetCurrentThreadId() {
|
|||
return pthread_self();
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
ThreadId OSThread::GetCurrentThreadTraceId() {
|
||||
return ThreadIdFromIntPtr(pthread_mach_thread_np(pthread_self()));
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ ThreadId OSThread::GetCurrentThreadId() {
|
|||
return ::GetCurrentThreadId();
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
ThreadId OSThread::GetCurrentThreadTraceId() {
|
||||
return ::GetCurrentThreadId();
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@ static intptr_t Prepare(const RegExp& regexp,
|
|||
|
||||
if (regexp.bytecode(is_one_byte, sticky) == TypedData::null()) {
|
||||
const String& pattern = String::Handle(zone, regexp.pattern());
|
||||
#if !defined(PRODUCT)
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
TimelineDurationScope tds(Thread::Current(), Timeline::GetCompilerStream(),
|
||||
"CompileIrregexpBytecode");
|
||||
if (tds.enabled()) {
|
||||
|
|
|
@ -3527,6 +3527,7 @@ static const MethodParameter* set_vm_timeline_flags_params[] = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
static bool HasStream(const char** recorded_streams, const char* stream) {
|
||||
while (*recorded_streams != NULL) {
|
||||
if ((strstr(*recorded_streams, "all") != NULL) ||
|
||||
|
@ -3537,12 +3538,13 @@ static bool HasStream(const char** recorded_streams, const char* stream) {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool SetVMTimelineFlags(Thread* thread, JSONStream* js) {
|
||||
if (!FLAG_support_timeline) {
|
||||
PrintSuccess(js);
|
||||
return true;
|
||||
}
|
||||
#if !defined(SUPPORT_TIMELINE)
|
||||
PrintSuccess(js);
|
||||
return true;
|
||||
#else
|
||||
Isolate* isolate = thread->isolate();
|
||||
ASSERT(isolate != NULL);
|
||||
StackZone zone(thread);
|
||||
|
@ -3562,6 +3564,7 @@ static bool SetVMTimelineFlags(Thread* thread, JSONStream* js) {
|
|||
PrintSuccess(js);
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const MethodParameter* get_vm_timeline_flags_params[] = {
|
||||
|
@ -3569,16 +3572,17 @@ static const MethodParameter* get_vm_timeline_flags_params[] = {
|
|||
};
|
||||
|
||||
static bool GetVMTimelineFlags(Thread* thread, JSONStream* js) {
|
||||
if (!FLAG_support_timeline) {
|
||||
JSONObject obj(js);
|
||||
obj.AddProperty("type", "TimelineFlags");
|
||||
return true;
|
||||
}
|
||||
#if !defined(SUPPORT_TIMELINE)
|
||||
JSONObject obj(js);
|
||||
obj.AddProperty("type", "TimelineFlags");
|
||||
return true;
|
||||
#else
|
||||
Isolate* isolate = thread->isolate();
|
||||
ASSERT(isolate != NULL);
|
||||
StackZone zone(thread);
|
||||
Timeline::PrintFlagsToJSON(js);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const MethodParameter* clear_vm_timeline_params[] = {
|
||||
|
|
|
@ -313,9 +313,9 @@ class RunServiceTask : public ThreadPool::Task {
|
|||
public:
|
||||
virtual void Run() {
|
||||
ASSERT(Isolate::Current() == NULL);
|
||||
#ifndef PRODUCT
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
TimelineDurationScope tds(Timeline::GetVMStream(), "ServiceIsolateStartup");
|
||||
#endif // !PRODUCT
|
||||
#endif // SUPPORT_TIMELINE
|
||||
char* error = NULL;
|
||||
Isolate* isolate = NULL;
|
||||
|
||||
|
|
|
@ -380,6 +380,7 @@ class ObjectPointerVisitor;
|
|||
V(DartVMService, "dart:_vmservice") \
|
||||
V(DartIOLibName, "dart.io") \
|
||||
V(DartVMProduct, "dart.vm.product") \
|
||||
V(DartDeveloperTimeline, "dart.developer.timeline") \
|
||||
V(EvalSourceUri, "evaluate:source") \
|
||||
V(ExternalName, "ExternalName") \
|
||||
V(_Random, "_Random") \
|
||||
|
|
|
@ -106,7 +106,7 @@ Thread::Thread(Isolate* isolate)
|
|||
interpreter_(nullptr),
|
||||
#endif
|
||||
next_(NULL) {
|
||||
#if !defined(PRODUCT)
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
dart_stream_ = Timeline::GetDartStream();
|
||||
ASSERT(dart_stream_ != NULL);
|
||||
#endif
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// 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.
|
||||
|
||||
#include "platform/globals.h"
|
||||
#ifndef PRODUCT
|
||||
#include "vm/globals.h"
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
|
||||
#include "vm/timeline.h"
|
||||
|
||||
|
@ -239,9 +239,11 @@ void Timeline::Cleanup() {
|
|||
Timeline::get_stop_recording_cb()();
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (FLAG_timeline_dir != NULL) {
|
||||
recorder_->WriteTo(FLAG_timeline_dir);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Disable global streams.
|
||||
#define TIMELINE_STREAM_DISABLE(name, not_used) \
|
||||
|
@ -281,6 +283,7 @@ void Timeline::ReclaimCachedBlocksFromThreads() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void Timeline::PrintFlagsToJSON(JSONStream* js) {
|
||||
JSONObject obj(js);
|
||||
obj.AddProperty("type", "TimelineFlags");
|
||||
|
@ -306,6 +309,7 @@ void Timeline::PrintFlagsToJSON(JSONStream* js) {
|
|||
#undef ADD_RECORDED_STREAM_NAME
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Timeline::Clear() {
|
||||
TimelineEventRecorder* recorder = Timeline::recorder();
|
||||
|
@ -621,6 +625,7 @@ bool TimelineEvent::Within(int64_t time_origin_micros,
|
|||
return (delta >= 0) && (delta <= time_extent_micros);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void TimelineEvent::PrintJSON(JSONStream* stream) const {
|
||||
if (!FLAG_support_service) {
|
||||
return;
|
||||
|
@ -712,6 +717,7 @@ void TimelineEvent::PrintJSON(JSONStream* stream) const {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int64_t TimelineEvent::TimeOrigin() const {
|
||||
return timestamp0_;
|
||||
|
@ -860,7 +866,7 @@ void TimelineEventScope::StealArguments(TimelineEvent* event) {
|
|||
TimelineDurationScope::TimelineDurationScope(TimelineStream* stream,
|
||||
const char* label)
|
||||
: TimelineEventScope(stream, label) {
|
||||
if (!FLAG_support_timeline || !enabled()) {
|
||||
if (!enabled()) {
|
||||
return;
|
||||
}
|
||||
timestamp_ = OS::GetCurrentMonotonicMicros();
|
||||
|
@ -871,7 +877,7 @@ TimelineDurationScope::TimelineDurationScope(Thread* thread,
|
|||
TimelineStream* stream,
|
||||
const char* label)
|
||||
: TimelineEventScope(thread, stream, label) {
|
||||
if (!FLAG_support_timeline || !enabled()) {
|
||||
if (!enabled()) {
|
||||
return;
|
||||
}
|
||||
timestamp_ = OS::GetCurrentMonotonicMicros();
|
||||
|
@ -879,9 +885,6 @@ TimelineDurationScope::TimelineDurationScope(Thread* thread,
|
|||
}
|
||||
|
||||
TimelineDurationScope::~TimelineDurationScope() {
|
||||
if (!FLAG_support_timeline) {
|
||||
return;
|
||||
}
|
||||
if (!ShouldEmitEvent()) {
|
||||
return;
|
||||
}
|
||||
|
@ -901,9 +904,6 @@ TimelineDurationScope::~TimelineDurationScope() {
|
|||
TimelineBeginEndScope::TimelineBeginEndScope(TimelineStream* stream,
|
||||
const char* label)
|
||||
: TimelineEventScope(stream, label) {
|
||||
if (!FLAG_support_timeline) {
|
||||
return;
|
||||
}
|
||||
EmitBegin();
|
||||
}
|
||||
|
||||
|
@ -911,23 +911,14 @@ TimelineBeginEndScope::TimelineBeginEndScope(Thread* thread,
|
|||
TimelineStream* stream,
|
||||
const char* label)
|
||||
: TimelineEventScope(thread, stream, label) {
|
||||
if (!FLAG_support_timeline) {
|
||||
return;
|
||||
}
|
||||
EmitBegin();
|
||||
}
|
||||
|
||||
TimelineBeginEndScope::~TimelineBeginEndScope() {
|
||||
if (!FLAG_support_timeline) {
|
||||
return;
|
||||
}
|
||||
EmitEnd();
|
||||
}
|
||||
|
||||
void TimelineBeginEndScope::EmitBegin() {
|
||||
if (!FLAG_support_timeline) {
|
||||
return;
|
||||
}
|
||||
if (!ShouldEmitEvent()) {
|
||||
return;
|
||||
}
|
||||
|
@ -944,9 +935,6 @@ void TimelineBeginEndScope::EmitBegin() {
|
|||
}
|
||||
|
||||
void TimelineBeginEndScope::EmitEnd() {
|
||||
if (!FLAG_support_timeline) {
|
||||
return;
|
||||
}
|
||||
if (!ShouldEmitEvent()) {
|
||||
return;
|
||||
}
|
||||
|
@ -983,6 +971,7 @@ IsolateTimelineEventFilter::IsolateTimelineEventFilter(
|
|||
TimelineEventRecorder::TimelineEventRecorder()
|
||||
: async_id_(0), time_low_micros_(0), time_high_micros_(0) {}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void TimelineEventRecorder::PrintJSONMeta(JSONArray* events) const {
|
||||
if (!FLAG_support_service) {
|
||||
return;
|
||||
|
@ -1009,6 +998,7 @@ void TimelineEventRecorder::PrintJSONMeta(JSONArray* events) const {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
TimelineEvent* TimelineEventRecorder::ThreadBlockStartEvent() {
|
||||
// Grab the current thread.
|
||||
|
@ -1105,6 +1095,7 @@ void TimelineEventRecorder::ThreadBlockCompleteEvent(TimelineEvent* event) {
|
|||
thread_block_lock->Unlock();
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void TimelineEventRecorder::WriteTo(const char* directory) {
|
||||
if (!FLAG_support_service) {
|
||||
return;
|
||||
|
@ -1143,6 +1134,7 @@ void TimelineEventRecorder::WriteTo(const char* directory) {
|
|||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
int64_t TimelineEventRecorder::GetNextAsyncId() {
|
||||
// TODO(johnmccutchan): Gracefully handle wrap around.
|
||||
|
@ -1195,6 +1187,7 @@ TimelineEventFixedBufferRecorder::~TimelineEventFixedBufferRecorder() {
|
|||
delete memory_;
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void TimelineEventFixedBufferRecorder::PrintJSONEvents(
|
||||
JSONArray* events,
|
||||
TimelineEventFilter* filter) {
|
||||
|
@ -1253,6 +1246,7 @@ void TimelineEventFixedBufferRecorder::PrintTraceEvent(
|
|||
PrintJSONMeta(&events);
|
||||
PrintJSONEvents(&events, filter);
|
||||
}
|
||||
#endif
|
||||
|
||||
TimelineEventBlock* TimelineEventFixedBufferRecorder::GetHeadBlockLocked() {
|
||||
return &blocks_[0];
|
||||
|
@ -1320,6 +1314,7 @@ TimelineEventCallbackRecorder::TimelineEventCallbackRecorder() {}
|
|||
|
||||
TimelineEventCallbackRecorder::~TimelineEventCallbackRecorder() {}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void TimelineEventCallbackRecorder::PrintJSON(JSONStream* js,
|
||||
TimelineEventFilter* filter) {
|
||||
if (!FLAG_support_service) {
|
||||
|
@ -1341,6 +1336,7 @@ void TimelineEventCallbackRecorder::PrintTraceEvent(
|
|||
}
|
||||
JSONArray events(js);
|
||||
}
|
||||
#endif
|
||||
|
||||
TimelineEvent* TimelineEventCallbackRecorder::StartEvent() {
|
||||
TimelineEvent* event = new TimelineEvent();
|
||||
|
@ -1356,6 +1352,7 @@ TimelineEventPlatformRecorder::TimelineEventPlatformRecorder() {}
|
|||
|
||||
TimelineEventPlatformRecorder::~TimelineEventPlatformRecorder() {}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void TimelineEventPlatformRecorder::PrintJSON(JSONStream* js,
|
||||
TimelineEventFilter* filter) {
|
||||
if (!FLAG_support_service) {
|
||||
|
@ -1377,6 +1374,7 @@ void TimelineEventPlatformRecorder::PrintTraceEvent(
|
|||
}
|
||||
JSONArray events(js);
|
||||
}
|
||||
#endif
|
||||
|
||||
TimelineEvent* TimelineEventPlatformRecorder::StartEvent() {
|
||||
TimelineEvent* event = new TimelineEvent();
|
||||
|
@ -1402,6 +1400,7 @@ TimelineEventEndlessRecorder::~TimelineEventEndlessRecorder() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void TimelineEventEndlessRecorder::PrintJSON(JSONStream* js,
|
||||
TimelineEventFilter* filter) {
|
||||
if (!FLAG_support_service) {
|
||||
|
@ -1428,6 +1427,7 @@ void TimelineEventEndlessRecorder::PrintTraceEvent(
|
|||
PrintJSONMeta(&events);
|
||||
PrintJSONEvents(&events, filter);
|
||||
}
|
||||
#endif
|
||||
|
||||
TimelineEventBlock* TimelineEventEndlessRecorder::GetHeadBlockLocked() {
|
||||
return head_;
|
||||
|
@ -1455,6 +1455,7 @@ TimelineEventBlock* TimelineEventEndlessRecorder::GetNewBlockLocked() {
|
|||
return head_;
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
static int TimelineEventBlockCompare(TimelineEventBlock* const* a,
|
||||
TimelineEventBlock* const* b) {
|
||||
return (*a)->LowerTimeBound() - (*b)->LowerTimeBound();
|
||||
|
@ -1500,6 +1501,7 @@ void TimelineEventEndlessRecorder::PrintJSONEvents(
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void TimelineEventEndlessRecorder::Clear() {
|
||||
TimelineEventBlock* current = head_;
|
||||
|
@ -1525,6 +1527,7 @@ TimelineEventBlock::~TimelineEventBlock() {
|
|||
Reset();
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void TimelineEventBlock::PrintJSON(JSONStream* js) const {
|
||||
ASSERT(!in_use());
|
||||
JSONArray events(js);
|
||||
|
@ -1533,6 +1536,7 @@ void TimelineEventBlock::PrintJSON(JSONStream* js) const {
|
|||
events.AddValue(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
TimelineEvent* TimelineEventBlock::StartEvent() {
|
||||
ASSERT(!IsFull());
|
||||
|
@ -1598,11 +1602,13 @@ void TimelineEventBlock::Finish() {
|
|||
OS::PrintErr("Finish block %p\n", this);
|
||||
}
|
||||
in_use_ = false;
|
||||
#ifndef PRODUCT
|
||||
if (Service::timeline_stream.enabled()) {
|
||||
ServiceEvent service_event(NULL, ServiceEvent::kTimelineEvents);
|
||||
service_event.set_timeline_event_block(this);
|
||||
Service::HandleEvent(&service_event);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
TimelineEventBlockIterator::TimelineEventBlockIterator(
|
||||
|
@ -1727,4 +1733,4 @@ void DartTimelineEventHelpers::ReportInstantEvent(Thread* thread,
|
|||
|
||||
} // namespace dart
|
||||
|
||||
#endif // !PRODUCT
|
||||
#endif // defined(SUPPORT_TIMELINE)
|
||||
|
|
|
@ -89,8 +89,10 @@ class Timeline : public AllStatic {
|
|||
|
||||
static void Clear();
|
||||
|
||||
#ifndef PRODUCT
|
||||
// Print information about streams to JSON.
|
||||
static void PrintFlagsToJSON(JSONStream* json);
|
||||
#endif
|
||||
|
||||
#define TIMELINE_STREAM_ACCESSOR(name, not_used) \
|
||||
static TimelineStream* Get##name##Stream() { return &stream_##name##_; }
|
||||
|
@ -311,7 +313,9 @@ class TimelineEvent {
|
|||
// The highest time value stored in this event.
|
||||
int64_t HighTime() const;
|
||||
|
||||
#ifndef PRODUCT
|
||||
void PrintJSON(JSONStream* stream) const;
|
||||
#endif
|
||||
|
||||
ThreadId thread() const { return thread_; }
|
||||
|
||||
|
@ -447,7 +451,9 @@ class TimelineEvent {
|
|||
DISALLOW_COPY_AND_ASSIGN(TimelineEvent);
|
||||
};
|
||||
|
||||
#ifndef PRODUCT
|
||||
#ifdef SUPPORT_TIMELINE
|
||||
#define TIMELINE_DURATION(thread, stream, name) \
|
||||
TimelineDurationScope(thread, Timeline::Get##stream##Stream(), name);
|
||||
#define TIMELINE_FUNCTION_COMPILATION_DURATION(thread, name, function) \
|
||||
TimelineDurationScope tds(thread, Timeline::GetCompilerStream(), name); \
|
||||
if (tds.enabled()) { \
|
||||
|
@ -463,6 +469,7 @@ class TimelineEvent {
|
|||
tds.SetNumArguments(1); \
|
||||
tds.CopyArgument(0, "mode", "basic");
|
||||
#else
|
||||
#define TIMELINE_DURATION(thread, stream, name)
|
||||
#define TIMELINE_FUNCTION_COMPILATION_DURATION(thread, name, function)
|
||||
#define TIMELINE_FUNCTION_GC_DURATION(thread, name)
|
||||
#define TIMELINE_FUNCTION_GC_DURATION_BASIC(thread, name)
|
||||
|
@ -598,7 +605,9 @@ class TimelineEventBlock {
|
|||
ThreadId thread_id() const { return thread_id_; }
|
||||
|
||||
protected:
|
||||
#ifndef PRODUCT
|
||||
void PrintJSON(JSONStream* stream) const;
|
||||
#endif
|
||||
|
||||
TimelineEvent* StartEvent();
|
||||
|
||||
|
@ -689,15 +698,19 @@ class TimelineEventRecorder {
|
|||
TimelineEventBlock* GetNewBlock();
|
||||
|
||||
// Interface method(s) which must be implemented.
|
||||
#ifndef PRODUCT
|
||||
virtual void PrintJSON(JSONStream* js, TimelineEventFilter* filter) = 0;
|
||||
virtual void PrintTraceEvent(JSONStream* js, TimelineEventFilter* filter) = 0;
|
||||
#endif
|
||||
virtual const char* name() const = 0;
|
||||
int64_t GetNextAsyncId();
|
||||
|
||||
void FinishBlock(TimelineEventBlock* block);
|
||||
|
||||
protected:
|
||||
#ifndef PRODUCT
|
||||
void WriteTo(const char* directory);
|
||||
#endif
|
||||
|
||||
// Interface method(s) which must be implemented.
|
||||
virtual TimelineEvent* StartEvent() = 0;
|
||||
|
@ -707,7 +720,9 @@ class TimelineEventRecorder {
|
|||
virtual void Clear() = 0;
|
||||
|
||||
// Utility method(s).
|
||||
#ifndef PRODUCT
|
||||
void PrintJSONMeta(JSONArray* array) const;
|
||||
#endif
|
||||
TimelineEvent* ThreadBlockStartEvent();
|
||||
void ThreadBlockCompleteEvent(TimelineEvent* event);
|
||||
|
||||
|
@ -739,8 +754,10 @@ class TimelineEventFixedBufferRecorder : public TimelineEventRecorder {
|
|||
explicit TimelineEventFixedBufferRecorder(intptr_t capacity);
|
||||
virtual ~TimelineEventFixedBufferRecorder();
|
||||
|
||||
#ifndef PRODUCT
|
||||
void PrintJSON(JSONStream* js, TimelineEventFilter* filter);
|
||||
void PrintTraceEvent(JSONStream* js, TimelineEventFilter* filter);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
TimelineEvent* StartEvent();
|
||||
|
@ -749,7 +766,9 @@ class TimelineEventFixedBufferRecorder : public TimelineEventRecorder {
|
|||
intptr_t FindOldestBlockIndex() const;
|
||||
void Clear();
|
||||
|
||||
#ifndef PRODUCT
|
||||
void PrintJSONEvents(JSONArray* array, TimelineEventFilter* filter);
|
||||
#endif
|
||||
|
||||
VirtualMemory* memory_;
|
||||
TimelineEventBlock* blocks_;
|
||||
|
@ -793,8 +812,10 @@ class TimelineEventCallbackRecorder : public TimelineEventRecorder {
|
|||
TimelineEventCallbackRecorder();
|
||||
virtual ~TimelineEventCallbackRecorder();
|
||||
|
||||
#ifndef PRODUCT
|
||||
void PrintJSON(JSONStream* js, TimelineEventFilter* filter);
|
||||
void PrintTraceEvent(JSONStream* js, TimelineEventFilter* filter);
|
||||
#endif
|
||||
|
||||
// Called when |event| is completed. It is unsafe to keep a reference to
|
||||
// |event| as it may be freed as soon as this function returns.
|
||||
|
@ -818,8 +839,10 @@ class TimelineEventEndlessRecorder : public TimelineEventRecorder {
|
|||
TimelineEventEndlessRecorder();
|
||||
virtual ~TimelineEventEndlessRecorder();
|
||||
|
||||
#ifndef PRODUCT
|
||||
void PrintJSON(JSONStream* js, TimelineEventFilter* filter);
|
||||
void PrintTraceEvent(JSONStream* js, TimelineEventFilter* filter);
|
||||
#endif
|
||||
|
||||
const char* name() const { return "Endless"; }
|
||||
|
||||
|
@ -830,7 +853,9 @@ class TimelineEventEndlessRecorder : public TimelineEventRecorder {
|
|||
TimelineEventBlock* GetHeadBlockLocked();
|
||||
void Clear();
|
||||
|
||||
#ifndef PRODUCT
|
||||
void PrintJSONEvents(JSONArray* array, TimelineEventFilter* filter);
|
||||
#endif
|
||||
|
||||
TimelineEventBlock* head_;
|
||||
intptr_t block_index_;
|
||||
|
@ -865,8 +890,10 @@ class TimelineEventPlatformRecorder : public TimelineEventRecorder {
|
|||
TimelineEventPlatformRecorder();
|
||||
virtual ~TimelineEventPlatformRecorder();
|
||||
|
||||
#ifndef PRODUCT
|
||||
void PrintJSON(JSONStream* js, TimelineEventFilter* filter);
|
||||
void PrintTraceEvent(JSONStream* js, TimelineEventFilter* filter);
|
||||
#endif
|
||||
|
||||
// Called when |event| is completed. It is unsafe to keep a reference to
|
||||
// |event| as it may be freed as soon as this function returns.
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// 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.
|
||||
|
||||
#include "platform/globals.h"
|
||||
#if defined(HOST_OS_ANDROID) && !defined(PRODUCT)
|
||||
#include "vm/globals.h"
|
||||
#if defined(HOST_OS_ANDROID) && defined(SUPPORT_TIMELINE)
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// 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.
|
||||
|
||||
#include "platform/globals.h"
|
||||
#if defined(HOST_OS_FUCHSIA) && !defined(PRODUCT)
|
||||
#include "vm/globals.h"
|
||||
#if defined(HOST_OS_FUCHSIA) && defined(SUPPORT_TIMELINE)
|
||||
|
||||
#include <trace-engine/context.h>
|
||||
#include <trace-engine/instrumentation.h>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// 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.
|
||||
|
||||
#include "platform/globals.h"
|
||||
#if defined(HOST_OS_LINUX) && !defined(PRODUCT)
|
||||
#include "vm/globals.h"
|
||||
#if defined(HOST_OS_LINUX) && defined(SUPPORT_TIMELINE)
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
part of dart.developer;
|
||||
|
||||
const bool _isProduct = const bool.fromEnvironment("dart.vm.product");
|
||||
const bool _hasTimeline =
|
||||
const bool.fromEnvironment("dart.developer.timeline", defaultValue: true);
|
||||
|
||||
/// A typedef for the function argument to [Timeline.timeSync].
|
||||
typedef dynamic TimelineSyncFunction();
|
||||
|
@ -100,7 +101,7 @@ class Timeline {
|
|||
/// a [Flow] event. This operation must be finished before
|
||||
/// returning to the event queue.
|
||||
static void startSync(String name, {Map arguments, Flow flow}) {
|
||||
if (_isProduct) return;
|
||||
if (!_hasTimeline) return;
|
||||
ArgumentError.checkNotNull(name, 'name');
|
||||
if (!_isDartStreamEnabled()) {
|
||||
// Push a null onto the stack and return.
|
||||
|
@ -119,7 +120,7 @@ class Timeline {
|
|||
|
||||
/// Finish the last synchronous operation that was started.
|
||||
static void finishSync() {
|
||||
if (_isProduct) {
|
||||
if (!_hasTimeline) {
|
||||
return;
|
||||
}
|
||||
if (_stack.length == 0) {
|
||||
|
@ -137,7 +138,7 @@ class Timeline {
|
|||
|
||||
/// Emit an instant event.
|
||||
static void instantSync(String name, {Map arguments}) {
|
||||
if (_isProduct) return;
|
||||
if (!_hasTimeline) return;
|
||||
ArgumentError.checkNotNull(name, 'name');
|
||||
if (!_isDartStreamEnabled()) {
|
||||
// Stream is disabled.
|
||||
|
@ -187,7 +188,7 @@ class TimelineTask {
|
|||
/// Start a synchronous operation within this task named [name].
|
||||
/// Optionally takes a [Map] of [arguments].
|
||||
void start(String name, {Map arguments}) {
|
||||
if (_isProduct) return;
|
||||
if (!_hasTimeline) return;
|
||||
ArgumentError.checkNotNull(name, 'name');
|
||||
var block = new _AsyncBlock._(name, _taskId);
|
||||
if (arguments != null) {
|
||||
|
@ -199,7 +200,7 @@ class TimelineTask {
|
|||
|
||||
/// Emit an instant event for this task.
|
||||
void instant(String name, {Map arguments}) {
|
||||
if (_isProduct) return;
|
||||
if (!_hasTimeline) return;
|
||||
ArgumentError.checkNotNull(name, 'name');
|
||||
Map instantArguments;
|
||||
if (arguments != null) {
|
||||
|
@ -211,7 +212,7 @@ class TimelineTask {
|
|||
|
||||
/// Finish the last synchronous operation that was started.
|
||||
void finish() {
|
||||
if (_isProduct) {
|
||||
if (!_hasTimeline) {
|
||||
return;
|
||||
}
|
||||
if (_stack.length == 0) {
|
||||
|
|
Loading…
Reference in a new issue