Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
dart::CombinedCodeStatistics Class Reference

#include <code_statistics.h>

Public Types

enum  EntryCounter {
  kTagAssertAssignableParameterCheck , kTagAssertAssignableInsertedByFrontend , kTagAssertAssignableFromSource , kTagCheckedEntry ,
  kTagIntrinsics , kNumEntries
}
 

Public Member Functions

 CombinedCodeStatistics ()
 
void Begin (Instruction *instruction)
 
void End (Instruction *instruction)
 
void DumpStatistics ()
 

Static Public Member Functions

static EntryCounter SlowPathCounterFor (Instruction::Tag tag)
 

Friends

class CodeStatistics
 

Detailed Description

Definition at line 18 of file code_statistics.h.

Member Enumeration Documentation

◆ EntryCounter

Enumerator
kTagAssertAssignableParameterCheck 
kTagAssertAssignableInsertedByFrontend 
kTagAssertAssignableFromSource 
kTagCheckedEntry 
kTagIntrinsics 
kNumEntries 

Definition at line 21 of file code_statistics.h.

21 {
22#define DO(type, attrs) kTag##type,
24#undef DO
25
26#define DO(type, attrs) kTag##type##SlowPath,
28#undef DO
29
33
36
38 };
#define DO(type, attrs)
#define FOR_EACH_INSTRUCTION(M)
Definition: il.h:405

Constructor & Destructor Documentation

◆ CombinedCodeStatistics()

dart::CombinedCodeStatistics::CombinedCodeStatistics ( )

Definition at line 9 of file code_statistics.cc.

9 {
10 unaccounted_bytes_ = 0;
11 alignment_bytes_ = 0;
12 object_header_bytes_ = 0;
13 return_const_count_ = 0;
14 return_const_with_load_field_count_ = 0;
15 intptr_t i = 0;
16
17#define DO(type, attrs) \
18 entries_[i].name = #type; \
19 entries_[i].bytes = 0; \
20 entries_[i++].count = 0;
21
23
24#undef DO
25
26#define DO(type, attrs) \
27 entries_[i].name = "SlowPath:" #type; \
28 entries_[i].bytes = 0; \
29 entries_[i++].count = 0;
30
32
33#undef DO
34
35#define INIT_SPECIAL_ENTRY(tag, str) \
36 entries_[tag].name = str; \
37 entries_[tag].bytes = 0; \
38 entries_[tag].count = 0;
39
41 "AssertAssignable:ParameterCheck");
43 "AssertAssignable:InsertedByFrontend");
45 "AssertAssignable:FromSource");
46
47 INIT_SPECIAL_ENTRY(kTagCheckedEntry, "<checked-entry-prologue>");
48 INIT_SPECIAL_ENTRY(kTagIntrinsics, "<intrinsics>");
49#undef INIT_SPECIAL_ENTRY
50}
#define INIT_SPECIAL_ENTRY(tag, str)
#define DO(type, attrs)

Member Function Documentation

◆ Begin()

void dart::CombinedCodeStatistics::Begin ( Instruction instruction)

◆ DumpStatistics()

void dart::CombinedCodeStatistics::DumpStatistics ( )

Definition at line 52 of file code_statistics.cc.

52 {
53 ASSERT(unaccounted_bytes_ >= 0);
54
55 Entry* sorted[kNumEntries];
56 for (intptr_t i = 0; i < kNumEntries; i++) {
57 sorted[i] = &entries_[i];
58 }
59 qsort(sorted, kNumEntries, sizeof(Entry*), &CompareEntries);
60
61 intptr_t instruction_bytes = 0;
62 for (intptr_t i = 0; i < kNumEntries; i++) {
63 instruction_bytes += entries_[i].bytes;
64 }
65 intptr_t total = object_header_bytes_ + instruction_bytes +
66 unaccounted_bytes_ + alignment_bytes_;
67 float ftotal = static_cast<float>(total) / 100.0;
68
69 OS::PrintErr("--------------------\n");
70
71 for (intptr_t i = 0; i < kNumEntries; i++) {
72 Entry* entry = sorted[i];
73 const char* name = entry->name;
74 intptr_t bytes = entry->bytes;
75 intptr_t count = entry->count;
76 float percent = bytes / ftotal;
77 float avg = static_cast<float>(bytes) / count;
78 if (bytes > 0) {
80 "%5.2f %% "
81 "% 8" Pd
82 " bytes "
83 "% 8" Pd
84 " count "
85 "%8.2f avg bytes/entry "
86 "- %s\n",
87 percent, bytes, count, avg, name);
88 }
89 }
90
91 OS::PrintErr("--------------------\n");
92
93 OS::PrintErr("%5.2f %% % 8" Pd " bytes unaccounted\n",
94 unaccounted_bytes_ / ftotal, unaccounted_bytes_);
95 OS::PrintErr("%5.2f %% % 8" Pd " bytes alignment\n",
96 alignment_bytes_ / ftotal, alignment_bytes_);
97 OS::PrintErr("%5.2f %% % 8" Pd " bytes instruction object header\n",
98 object_header_bytes_ / ftotal, object_header_bytes_);
99 OS::PrintErr("%5.2f %% % 8" Pd " bytes instructions\n",
100 instruction_bytes / ftotal, instruction_bytes);
101 OS::PrintErr("--------------------\n");
102 OS::PrintErr("%5.2f %% % 8" Pd " bytes in total\n", total / ftotal, total);
103 OS::PrintErr("--------------------\n");
104 OS::PrintErr("% 8" Pd " return-constant functions\n", return_const_count_);
105 OS::PrintErr("% 8" Pd " return-constant-with-load-field functions\n",
106 return_const_with_load_field_count_);
107 OS::PrintErr("--------------------\n");
108}
int count
Definition: FontMgrTest.cpp:50
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
#define ASSERT(E)
const char *const name
#define Pd
Definition: globals.h:408

◆ End()

void dart::CombinedCodeStatistics::End ( Instruction instruction)

◆ SlowPathCounterFor()

static EntryCounter dart::CombinedCodeStatistics::SlowPathCounterFor ( Instruction::Tag  tag)
inlinestatic

Definition at line 48 of file code_statistics.h.

48 {
49 return static_cast<CombinedCodeStatistics::EntryCounter>(
50 CombinedCodeStatistics::kTagGraphEntrySlowPath + tag);
51 }

Friends And Related Function Documentation

◆ CodeStatistics

friend class CodeStatistics
friend

Definition at line 54 of file code_statistics.h.


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