Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::ProfileStackWalker Class Reference

Public Member Functions

 ProfileStackWalker (Profile *profile, bool as_func=false)
 
bool Down ()
 
const char * CurrentName ()
 
const char * CurrentToken ()
 
intptr_t CurrentInclusiveTicks ()
 
intptr_t CurrentExclusiveTicks ()
 
const char * VMTagName ()
 

Detailed Description

Definition at line 284 of file profiler_test.cc.

Constructor & Destructor Documentation

◆ ProfileStackWalker()

dart::ProfileStackWalker::ProfileStackWalker ( Profile profile,
bool  as_func = false 
)
inlineexplicit

Definition at line 286 of file profiler_test.cc.

287 : profile_(profile),
288 as_functions_(as_func),
289 index_(0),
290 sample_(profile->SampleAt(0)) {
291 ClearInliningData();
292 }

Member Function Documentation

◆ CurrentExclusiveTicks()

intptr_t dart::ProfileStackWalker::CurrentExclusiveTicks ( )
inline

Definition at line 361 of file profiler_test.cc.

361 {
362 if (as_functions_) {
363 ProfileFunction* func = GetFunction();
364 EXPECT(func != nullptr);
365 return func->exclusive_ticks();
366 } else {
367 ProfileCode* code = GetCode();
368 ASSERT(code != nullptr);
369 return code->exclusive_ticks();
370 }
371 }
#define EXPECT(type, expectedAlignment, expectedSize)
#define ASSERT(E)

◆ CurrentInclusiveTicks()

intptr_t dart::ProfileStackWalker::CurrentInclusiveTicks ( )
inline

Definition at line 349 of file profiler_test.cc.

349 {
350 if (as_functions_) {
351 ProfileFunction* func = GetFunction();
352 EXPECT(func != nullptr);
353 return func->inclusive_ticks();
354 } else {
355 ProfileCode* code = GetCode();
356 ASSERT(code != nullptr);
357 return code->inclusive_ticks();
358 }
359 }

◆ CurrentName()

const char * dart::ProfileStackWalker::CurrentName ( )
inline

Definition at line 303 of file profiler_test.cc.

303 {
304 if (as_functions_) {
305 ProfileFunction* func = GetFunction();
306 EXPECT(func != nullptr);
307 return func->Name();
308 } else {
309 ProfileCode* code = GetCode();
310 EXPECT(code != nullptr);
311 return code->name();
312 }
313 }

◆ CurrentToken()

const char * dart::ProfileStackWalker::CurrentToken ( )
inline

Definition at line 315 of file profiler_test.cc.

315 {
316 if (!as_functions_) {
317 return nullptr;
318 }
319 ProfileFunction* func = GetFunction();
320 const Function& function = *(func->function());
321 if (function.IsNull()) {
322 // No function.
323 return nullptr;
324 }
325 Zone* zone = Thread::Current()->zone();
326 const Script& script = Script::Handle(zone, function.script());
327 if (script.IsNull()) {
328 // No script.
329 return nullptr;
330 }
331 ProfileFunctionSourcePosition pfsp(TokenPosition::kNoSource);
332 if (!func->GetSinglePosition(&pfsp)) {
333 // Not exactly one source position.
334 return nullptr;
335 }
336
337 const TokenPosition& token_pos = pfsp.token_pos();
338 intptr_t line, column;
339 if (script.GetTokenLocation(token_pos, &line, &column)) {
340 const intptr_t token_len = script.GetTokenLength(token_pos);
341 const auto& str = String::Handle(
342 zone, script.GetSnippet(line, column, line, column + token_len));
343 if (!str.IsNull()) return str.ToCString();
344 }
345 // Couldn't get line/number information.
346 return nullptr;
347 }
static Object & Handle()
Definition: object.h:407
Zone * zone() const
Definition: thread_state.h:37
static Thread * Current()
Definition: thread.h:362
Dart_NativeFunction function
Definition: fuchsia.cc:51

◆ Down()

bool dart::ProfileStackWalker::Down ( )
inline

Definition at line 294 of file profiler_test.cc.

294 {
295 if (as_functions_) {
296 return UpdateFunctionIndex();
297 } else {
298 ++index_;
299 return (index_ < sample_->length());
300 }
301 }
size_t length

◆ VMTagName()

const char * dart::ProfileStackWalker::VMTagName ( )
inline

Definition at line 373 of file profiler_test.cc.

373{ return VMTag::TagName(sample_->vm_tag()); }
uword vm_tag() const
Definition: profiler.h:826
static const char * TagName(uword id)
Definition: tags.cc:19

The documentation for this class was generated from the following file: