Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Attributes | List of all members
dart::Sample Class Reference

#include <profiler.h>

Public Member Functions

 Sample ()=default
 
void Init (Dart_Port port, int64_t timestamp, ThreadId tid)
 
Dart_Port port () const
 
ThreadId tid () const
 
void Clear ()
 
int64_t timestamp () const
 
uword pc () const
 
uword At (intptr_t i) const
 
void SetAt (intptr_t i, uword pc)
 
void DumpStackTrace ()
 
uword vm_tag () const
 
void set_vm_tag (uword tag)
 
uword user_tag () const
 
void set_user_tag (uword tag)
 
bool leaf_frame_is_dart () const
 
void set_leaf_frame_is_dart (bool leaf_frame_is_dart)
 
bool ignore_sample () const
 
void set_ignore_sample (bool ignore_sample)
 
bool exit_frame_sample () const
 
void set_exit_frame_sample (bool exit_frame_sample)
 
bool missing_frame_inserted () const
 
void set_missing_frame_inserted (bool missing_frame_inserted)
 
bool truncated_trace () const
 
void set_truncated_trace (bool truncated_trace)
 
bool is_allocation_sample () const
 
void set_is_allocation_sample (bool allocation_sample)
 
uint32_t allocation_identity_hash () const
 
void set_allocation_identity_hash (uint32_t hash)
 
Thread::TaskKind thread_task () const
 
void set_thread_task (Thread::TaskKind task)
 
bool is_continuation_sample () const
 
void SetContinuation (Sample *next)
 
Samplecontinuation_sample () const
 
intptr_t allocation_cid () const
 
void set_head_sample (bool head_sample)
 
bool head_sample () const
 
intptr_t metadata () const
 
void set_metadata (intptr_t metadata)
 
void SetAllocationCid (intptr_t cid)
 
uwordGetPCArray ()
 
uwordGetStackBuffer ()
 

Static Public Attributes

static constexpr int kPCArraySizeInWords = 32
 
static constexpr int kStackBufferSizeInWords = 2
 

Detailed Description

Definition at line 195 of file profiler.h.

Constructor & Destructor Documentation

◆ Sample()

dart::Sample::Sample ( )
default

Member Function Documentation

◆ allocation_cid()

intptr_t dart::Sample::allocation_cid ( ) const
inline

Definition at line 341 of file profiler.h.

341 {
343 return metadata();
344 }
bool is_allocation_sample() const
Definition: profiler.h:306
intptr_t metadata() const
Definition: profiler.h:352
#define ASSERT(E)

◆ allocation_identity_hash()

uint32_t dart::Sample::allocation_identity_hash ( ) const
inline

Definition at line 314 of file profiler.h.

314 {
315 return allocation_identity_hash_;
316 }

◆ At()

uword dart::Sample::At ( intptr_t  i) const
inline

Definition at line 237 of file profiler.h.

237 {
238 ASSERT(i >= 0);
240 return pc_array_[i];
241 }
static constexpr int kPCArraySizeInWords
Definition: profiler.h:362

◆ Clear()

void dart::Sample::Clear ( )
inline

Definition at line 212 of file profiler.h.

212 {
213 timestamp_ = 0;
214 port_ = ILLEGAL_PORT;
216 for (intptr_t i = 0; i < kStackBufferSizeInWords; i++) {
217 stack_buffer_[i] = 0;
218 }
219 for (intptr_t i = 0; i < kPCArraySizeInWords; i++) {
220 pc_array_[i] = 0;
221 }
222 vm_tag_ = VMTag::kInvalidTagId;
223 user_tag_ = UserTags::kDefaultUserTag;
224 state_ = 0;
225 next_ = nullptr;
226 allocation_identity_hash_ = 0;
227 set_head_sample(true);
228 }
static const ThreadId kInvalidThreadId
Definition: os_thread.h:248
static constexpr int kStackBufferSizeInWords
Definition: profiler.h:365
void set_head_sample(bool head_sample)
Definition: profiler.h:346
static constexpr uword kDefaultUserTag
Definition: tags.h:112
@ kInvalidTagId
Definition: tags.h:38
#define ILLEGAL_PORT
Definition: dart_api.h:1535

◆ continuation_sample()

Sample * dart::Sample::continuation_sample ( ) const
inline

Definition at line 339 of file profiler.h.

339{ return next_; }

◆ DumpStackTrace()

void dart::Sample::DumpStackTrace ( )
inline

Definition at line 250 of file profiler.h.

250 {
251 for (intptr_t i = 0; i < kPCArraySizeInWords; ++i) {
252 uintptr_t start = 0;
253 uword pc = At(i);
254 const char* native_symbol_name =
256 if (native_symbol_name == nullptr) {
257 OS::PrintErr(" [0x%" Pp "] Unknown symbol\n", pc);
258 } else {
259 OS::PrintErr(" [0x%" Pp "] %s\n", pc, native_symbol_name);
260 NativeSymbolResolver::FreeSymbolName(native_symbol_name);
261 }
262 }
263 }
static const char * LookupSymbolName(uword pc, uword *start)
static void FreeSymbolName(const char *name)
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
uword At(intptr_t i) const
Definition: profiler.h:237
uword pc() const
Definition: profiler.h:234
uintptr_t uword
Definition: globals.h:501
#define Pp
Definition: globals.h:425

◆ exit_frame_sample()

bool dart::Sample::exit_frame_sample ( ) const
inline

Definition at line 286 of file profiler.h.

286{ return ExitFrameBit::decode(state_); }
static constexpr T decode(S value)
Definition: bitfield.h:171

◆ GetPCArray()

uword * dart::Sample::GetPCArray ( )
inline

Definition at line 363 of file profiler.h.

363{ return &pc_array_[0]; }

◆ GetStackBuffer()

uword * dart::Sample::GetStackBuffer ( )
inline

Definition at line 366 of file profiler.h.

366{ return &stack_buffer_[0]; }

◆ head_sample()

bool dart::Sample::head_sample ( ) const
inline

Definition at line 350 of file profiler.h.

350{ return HeadSampleBit::decode(state_); }

◆ ignore_sample()

bool dart::Sample::ignore_sample ( ) const
inline

Definition at line 280 of file profiler.h.

280{ return IgnoreBit::decode(state_); }

◆ Init()

void dart::Sample::Init ( Dart_Port  port,
int64_t  timestamp,
ThreadId  tid 
)
inline

Definition at line 199 of file profiler.h.

199 {
200 Clear();
201 timestamp_ = timestamp;
202 tid_ = tid;
203 port_ = port;
204 next_ = nullptr;
205 }
ThreadId tid() const
Definition: profiler.h:210
int64_t timestamp() const
Definition: profiler.h:231
Dart_Port port() const
Definition: profiler.h:207
void Clear()
Definition: profiler.h:212

◆ is_allocation_sample()

bool dart::Sample::is_allocation_sample ( ) const
inline

Definition at line 306 of file profiler.h.

306 {
308 }

◆ is_continuation_sample()

bool dart::Sample::is_continuation_sample ( ) const
inline

Definition at line 328 of file profiler.h.

328 {
329 return ContinuationSampleBit::decode(state_);
330 }

◆ leaf_frame_is_dart()

bool dart::Sample::leaf_frame_is_dart ( ) const
inline

Definition at line 274 of file profiler.h.

274{ return LeafFrameIsDart::decode(state_); }

◆ metadata()

intptr_t dart::Sample::metadata ( ) const
inline

Definition at line 352 of file profiler.h.

352{ return MetadataBits::decode(state_); }

◆ missing_frame_inserted()

bool dart::Sample::missing_frame_inserted ( ) const
inline

Definition at line 292 of file profiler.h.

292 {
293 return MissingFrameInsertedBit::decode(state_);
294 }

◆ pc()

uword dart::Sample::pc ( ) const
inline

Definition at line 234 of file profiler.h.

234{ return At(0); }

◆ port()

Dart_Port dart::Sample::port ( ) const
inline

Definition at line 207 of file profiler.h.

207{ return port_; }

◆ set_allocation_identity_hash()

void dart::Sample::set_allocation_identity_hash ( uint32_t  hash)
inline

Definition at line 318 of file profiler.h.

318 {
319 allocation_identity_hash_ = hash;
320 }
static uint32_t hash(const SkShaderBase::GradientInfo &v)

◆ set_exit_frame_sample()

void dart::Sample::set_exit_frame_sample ( bool  exit_frame_sample)
inline

Definition at line 288 of file profiler.h.

288 {
289 state_ = ExitFrameBit::update(exit_frame_sample, state_);
290 }
static constexpr S update(T value, S original)
Definition: bitfield.h:188
bool exit_frame_sample() const
Definition: profiler.h:286

◆ set_head_sample()

void dart::Sample::set_head_sample ( bool  head_sample)
inline

Definition at line 346 of file profiler.h.

346 {
347 state_ = HeadSampleBit::update(head_sample, state_);
348 }
bool head_sample() const
Definition: profiler.h:350

◆ set_ignore_sample()

void dart::Sample::set_ignore_sample ( bool  ignore_sample)
inline

Definition at line 282 of file profiler.h.

282 {
283 state_ = IgnoreBit::update(ignore_sample, state_);
284 }
bool ignore_sample() const
Definition: profiler.h:280

◆ set_is_allocation_sample()

void dart::Sample::set_is_allocation_sample ( bool  allocation_sample)
inline

Definition at line 310 of file profiler.h.

310 {
311 state_ = ClassAllocationSampleBit::update(allocation_sample, state_);
312 }

◆ set_leaf_frame_is_dart()

void dart::Sample::set_leaf_frame_is_dart ( bool  leaf_frame_is_dart)
inline

Definition at line 276 of file profiler.h.

276 {
278 }
bool leaf_frame_is_dart() const
Definition: profiler.h:274

◆ set_metadata()

void dart::Sample::set_metadata ( intptr_t  metadata)
inline

Definition at line 353 of file profiler.h.

353 {
354 state_ = MetadataBits::update(metadata, state_);
355 }

◆ set_missing_frame_inserted()

void dart::Sample::set_missing_frame_inserted ( bool  missing_frame_inserted)
inline

Definition at line 296 of file profiler.h.

296 {
298 }
bool missing_frame_inserted() const
Definition: profiler.h:292

◆ set_thread_task()

void dart::Sample::set_thread_task ( Thread::TaskKind  task)
inline

Definition at line 324 of file profiler.h.

324 {
325 state_ = ThreadTaskBit::update(task, state_);
326 }

◆ set_truncated_trace()

void dart::Sample::set_truncated_trace ( bool  truncated_trace)
inline

Definition at line 302 of file profiler.h.

302 {
304 }
bool truncated_trace() const
Definition: profiler.h:300

◆ set_user_tag()

void dart::Sample::set_user_tag ( uword  tag)
inline

Definition at line 272 of file profiler.h.

272{ user_tag_ = tag; }

◆ set_vm_tag()

void dart::Sample::set_vm_tag ( uword  tag)
inline

Definition at line 266 of file profiler.h.

266 {
268 vm_tag_ = tag;
269 }

◆ SetAllocationCid()

void dart::Sample::SetAllocationCid ( intptr_t  cid)
inline

Definition at line 357 of file profiler.h.

357 {
360 }
void set_is_allocation_sample(bool allocation_sample)
Definition: profiler.h:310
void set_metadata(intptr_t metadata)
Definition: profiler.h:353
const intptr_t cid

◆ SetAt()

void dart::Sample::SetAt ( intptr_t  i,
uword  pc 
)
inline

Definition at line 244 of file profiler.h.

244 {
245 ASSERT(i >= 0);
247 pc_array_[i] = pc;
248 }

◆ SetContinuation()

void dart::Sample::SetContinuation ( Sample next)
inline

Definition at line 332 of file profiler.h.

332 {
334 ASSERT(next_ == nullptr);
335 state_ = ContinuationSampleBit::update(true, state_);
336 next_ = next;
337 }
static float next(float f)
bool is_continuation_sample() const
Definition: profiler.h:328

◆ thread_task()

Thread::TaskKind dart::Sample::thread_task ( ) const
inline

Definition at line 322 of file profiler.h.

322{ return ThreadTaskBit::decode(state_); }

◆ tid()

ThreadId dart::Sample::tid ( ) const
inline

Definition at line 210 of file profiler.h.

210{ return tid_; }

◆ timestamp()

int64_t dart::Sample::timestamp ( ) const
inline

Definition at line 231 of file profiler.h.

231{ return timestamp_; }

◆ truncated_trace()

bool dart::Sample::truncated_trace ( ) const
inline

Definition at line 300 of file profiler.h.

300{ return TruncatedTraceBit::decode(state_); }

◆ user_tag()

uword dart::Sample::user_tag ( ) const
inline

Definition at line 271 of file profiler.h.

271{ return user_tag_; }

◆ vm_tag()

uword dart::Sample::vm_tag ( ) const
inline

Definition at line 265 of file profiler.h.

265{ return vm_tag_; }

Member Data Documentation

◆ kPCArraySizeInWords

constexpr int dart::Sample::kPCArraySizeInWords = 32
staticconstexpr

Definition at line 362 of file profiler.h.

◆ kStackBufferSizeInWords

constexpr int dart::Sample::kStackBufferSizeInWords = 2
staticconstexpr

Definition at line 365 of file profiler.h.


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