Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: runtime/vm/profiler.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/profiler.h ('k') | runtime/vm/profiler_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index 840f438359bb62e7f0aca86a650467282959d987..7b8c6e70c01791d054bbbb1c3211cb2581916de2 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -79,7 +79,6 @@ void Profiler::InitOnce() {
initialized_ = true;
}
-
void Profiler::InitAllocationSampleBuffer() {
if (FLAG_profiler_native_memory &&
(Profiler::allocation_sample_buffer_ == NULL)) {
@@ -87,7 +86,6 @@ void Profiler::InitAllocationSampleBuffer() {
}
}
-
void Profiler::Shutdown() {
if (!FLAG_profiler) {
return;
@@ -97,7 +95,6 @@ void Profiler::Shutdown() {
NativeSymbolResolver::ShutdownOnce();
}
-
void Profiler::SetSampleDepth(intptr_t depth) {
const int kMinimumDepth = 2;
const int kMaximumDepth = 255;
@@ -110,7 +107,6 @@ void Profiler::SetSampleDepth(intptr_t depth) {
}
}
-
void Profiler::SetSamplePeriod(intptr_t period) {
const int kMinimumProfilePeriod = 50;
if (period < kMinimumProfilePeriod) {
@@ -120,23 +116,19 @@ void Profiler::SetSamplePeriod(intptr_t period) {
}
}
-
intptr_t Sample::pcs_length_ = 0;
intptr_t Sample::instance_size_ = 0;
-
void Sample::InitOnce() {
pcs_length_ = kSampleSize;
instance_size_ = sizeof(Sample) + (sizeof(uword) * pcs_length_); // NOLINT.
}
-
uword* Sample::GetPCArray() const {
return reinterpret_cast<uword*>(reinterpret_cast<uintptr_t>(this) +
sizeof(*this));
}
-
SampleBuffer::SampleBuffer(intptr_t capacity) {
ASSERT(Sample::instance_size() > 0);
@@ -159,21 +151,17 @@ SampleBuffer::SampleBuffer(intptr_t capacity) {
}
}
-
AllocationSampleBuffer::AllocationSampleBuffer(intptr_t capacity)
: SampleBuffer(capacity), mutex_(new Mutex()) {}
-
SampleBuffer::~SampleBuffer() {
delete memory_;
}
-
AllocationSampleBuffer::~AllocationSampleBuffer() {
delete mutex_;
}
-
Sample* SampleBuffer::At(intptr_t idx) const {
ASSERT(idx >= 0);
ASSERT(idx < capacity_);
@@ -182,7 +170,6 @@ Sample* SampleBuffer::At(intptr_t idx) const {
return reinterpret_cast<Sample*>(samples + offset);
}
-
intptr_t SampleBuffer::ReserveSampleSlot() {
ASSERT(samples_ != NULL);
uintptr_t cursor = AtomicOperations::FetchAndIncrement(&cursor_);
@@ -191,12 +178,10 @@ intptr_t SampleBuffer::ReserveSampleSlot() {
return cursor;
}
-
Sample* SampleBuffer::ReserveSample() {
return At(ReserveSampleSlot());
}
-
Sample* SampleBuffer::ReserveSampleAndLink(Sample* previous) {
ASSERT(previous != NULL);
intptr_t next_index = ReserveSampleSlot();
@@ -208,7 +193,6 @@ Sample* SampleBuffer::ReserveSampleAndLink(Sample* previous) {
return next;
}
-
void AllocationSampleBuffer::FreeAllocationSample(Sample* sample) {
MutexLocker ml(mutex_);
while (sample != NULL) {
@@ -228,7 +212,6 @@ void AllocationSampleBuffer::FreeAllocationSample(Sample* sample) {
}
}
-
intptr_t AllocationSampleBuffer::ReserveSampleSlotLocked() {
if (free_sample_list_ != NULL) {
Sample* free_sample = free_sample_list_;
@@ -245,7 +228,6 @@ intptr_t AllocationSampleBuffer::ReserveSampleSlotLocked() {
}
}
-
Sample* AllocationSampleBuffer::ReserveSampleAndLink(Sample* previous) {
MutexLocker ml(mutex_);
ASSERT(previous != NULL);
@@ -265,7 +247,6 @@ Sample* AllocationSampleBuffer::ReserveSampleAndLink(Sample* previous) {
return next;
}
-
Sample* AllocationSampleBuffer::ReserveSample() {
MutexLocker ml(mutex_);
intptr_t index = ReserveSampleSlotLocked();
@@ -275,7 +256,6 @@ Sample* AllocationSampleBuffer::ReserveSample() {
return At(index);
}
-
// Attempts to find the true return address when a Dart frame is being setup
// or torn down.
// NOTE: Architecture specific implementations below.
@@ -328,7 +308,6 @@ class ReturnAddressLocator : public ValueObject {
const Code& code_;
};
-
#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
bool ReturnAddressLocator::LocateReturnAddress(uword* return_address) {
ASSERT(return_address != NULL);
@@ -397,7 +376,6 @@ bool ReturnAddressLocator::LocateReturnAddress(uword* return_address) {
#error ReturnAddressLocator implementation missing for this architecture.
#endif
-
bool SampleFilter::TimeFilterSample(Sample* sample) {
if ((time_origin_micros_ == -1) || (time_extent_micros_ == -1)) {
// No time filter passed in, always pass.
@@ -408,7 +386,6 @@ bool SampleFilter::TimeFilterSample(Sample* sample) {
return (delta >= 0) && (delta <= time_extent_micros_);
}
-
bool SampleFilter::TaskFilterSample(Sample* sample) {
const intptr_t task = static_cast<intptr_t>(sample->thread_task());
if (thread_task_mask_ == kNoTaskFilter) {
@@ -417,16 +394,13 @@ bool SampleFilter::TaskFilterSample(Sample* sample) {
return (task & thread_task_mask_) != 0;
}
-
ClearProfileVisitor::ClearProfileVisitor(Isolate* isolate)
: SampleVisitor(isolate->main_port()) {}
-
void ClearProfileVisitor::VisitSample(Sample* sample) {
sample->Clear();
}
-
static void DumpStackFrame(intptr_t frame_index, uword pc) {
Isolate* isolate = Isolate::Current();
if ((isolate != NULL) && isolate->is_runnable()) {
@@ -452,7 +426,6 @@ static void DumpStackFrame(intptr_t frame_index, uword pc) {
}
}
-
class ProfilerStackWalker : public ValueObject {
public:
ProfilerStackWalker(Dart_Port port_id,
@@ -518,7 +491,6 @@ class ProfilerStackWalker : public ValueObject {
intptr_t total_frames_;
};
-
// Executing Dart code, walk the stack.
class ProfilerDartStackWalker : public ProfilerStackWalker {
public:
@@ -712,7 +684,6 @@ class ProfilerDartStackWalker : public ProfilerStackWalker {
bool has_exit_frame_;
};
-
// If the VM is compiled without frame pointers (which is the default on
// recent GCC versions with optimizing enabled) the stack walking code may
// fail.
@@ -825,7 +796,6 @@ class ProfilerNativeStackWalker : public ProfilerStackWalker {
uword lower_bound_;
};
-
static void CopyStackBuffer(Sample* sample, uword sp_addr) {
ASSERT(sample != NULL);
uword* sp = reinterpret_cast<uword*>(sp_addr);
@@ -840,7 +810,6 @@ static void CopyStackBuffer(Sample* sample, uword sp_addr) {
}
}
-
#if defined(HOST_OS_WINDOWS)
// On Windows this code is synchronously executed from the thread interrupter
// thread. This means we can safely have a static fault_address.
@@ -919,7 +888,6 @@ static void CollectSample(Isolate* isolate,
#endif
}
-
static bool ValidateThreadStackBounds(uintptr_t fp,
uintptr_t sp,
uword stack_lower,
@@ -942,7 +910,6 @@ static bool ValidateThreadStackBounds(uintptr_t fp,
return true;
}
-
// Get |isolate|'s stack boundary and verify that |sp| and |fp| are within
// it. If |get_os_thread_bounds| is true then if |isolate| stackbounds are
// not available we fallback to using underlying OS thread bounds. This only
@@ -998,7 +965,6 @@ static bool GetAndValidateThreadStackBounds(Thread* thread,
return ValidateThreadStackBounds(fp, sp, *stack_lower, *stack_upper);
}
-
// Some simple sanity checking of |pc|, |fp|, and |sp|.
static bool InitialRegisterCheck(uintptr_t pc, uintptr_t fp, uintptr_t sp) {
if ((sp == 0) || (fp == 0) || (pc == 0)) {
@@ -1015,7 +981,6 @@ static bool InitialRegisterCheck(uintptr_t pc, uintptr_t fp, uintptr_t sp) {
return true;
}
-
static Sample* SetupSample(Thread* thread,
SampleBuffer* sample_buffer,
ThreadId tid) {
@@ -1040,7 +1005,6 @@ static Sample* SetupSample(Thread* thread,
return sample;
}
-
static Sample* SetupSampleNative(SampleBuffer* sample_buffer, ThreadId tid) {
Sample* sample = sample_buffer->ReserveSample();
if (sample == NULL) {
@@ -1058,7 +1022,6 @@ static Sample* SetupSampleNative(SampleBuffer* sample_buffer, ThreadId tid) {
return sample;
}
-
static bool CheckIsolate(Isolate* isolate) {
if ((isolate == NULL) || (Dart::vm_isolate() == NULL)) {
// No isolate.
@@ -1067,7 +1030,6 @@ static bool CheckIsolate(Isolate* isolate) {
return isolate != Dart::vm_isolate();
}
-
void Profiler::DumpStackTrace(void* context) {
#if defined(HOST_OS_LINUX) || defined(HOST_OS_MACOS)
ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
@@ -1082,7 +1044,6 @@ void Profiler::DumpStackTrace(void* context) {
#endif
}
-
void Profiler::DumpStackTrace(bool for_crash) {
uintptr_t sp = Thread::GetCurrentStackPointer();
uintptr_t fp = 0;
@@ -1093,7 +1054,6 @@ void Profiler::DumpStackTrace(bool for_crash) {
DumpStackTrace(sp, fp, pc, for_crash);
}
-
void Profiler::DumpStackTrace(uword sp, uword fp, uword pc, bool for_crash) {
if (for_crash) {
// Allow only one stack trace to prevent recursively printing stack traces
@@ -1142,7 +1102,6 @@ void Profiler::DumpStackTrace(uword sp, uword fp, uword pc, bool for_crash) {
OS::PrintErr("-- End of DumpStackTrace\n");
}
-
void Profiler::SampleAllocation(Thread* thread, intptr_t cid) {
ASSERT(thread != NULL);
OSThread* os_thread = thread->os_thread();
@@ -1201,7 +1160,6 @@ void Profiler::SampleAllocation(Thread* thread, intptr_t cid) {
}
}
-
Sample* Profiler::SampleNativeAllocation(intptr_t skip_count,
uword address,
uintptr_t allocation_size) {
@@ -1256,7 +1214,6 @@ Sample* Profiler::SampleNativeAllocation(intptr_t skip_count,
return sample;
}
-
void Profiler::SampleThreadSingleFrame(Thread* thread, uintptr_t pc) {
ASSERT(thread != NULL);
OSThread* os_thread = thread->os_thread();
@@ -1282,7 +1239,6 @@ void Profiler::SampleThreadSingleFrame(Thread* thread, uintptr_t pc) {
sample->SetAt(0, pc);
}
-
void Profiler::SampleThread(Thread* thread,
const InterruptedThreadState& state) {
ASSERT(thread != NULL);
@@ -1395,32 +1351,26 @@ void Profiler::SampleThread(Thread* thread,
&counters_);
}
-
CodeDescriptor::CodeDescriptor(const Code& code) : code_(code) {
ASSERT(!code_.IsNull());
}
-
uword CodeDescriptor::Start() const {
return code_.PayloadStart();
}
-
uword CodeDescriptor::Size() const {
return code_.Size();
}
-
int64_t CodeDescriptor::CompileTimestamp() const {
return code_.compile_timestamp();
}
-
CodeLookupTable::CodeLookupTable(Thread* thread) {
Build(thread);
}
-
class CodeLookupTableBuilder : public ObjectVisitor {
public:
explicit CodeLookupTableBuilder(CodeLookupTable* table) : table_(table) {
@@ -1446,7 +1396,6 @@ class CodeLookupTableBuilder : public ObjectVisitor {
CodeLookupTable* table_;
};
-
void CodeLookupTable::Build(Thread* thread) {
ASSERT(thread != NULL);
Isolate* isolate = thread->isolate();
@@ -1485,14 +1434,12 @@ void CodeLookupTable::Build(Thread* thread) {
#endif
}
-
void CodeLookupTable::Add(const Code& code) {
ASSERT(!code.IsNull());
CodeDescriptor* cd = new CodeDescriptor(code);
code_objects_.Add(cd);
}
-
const CodeDescriptor* CodeLookupTable::FindCode(uword pc) const {
intptr_t first = 0;
intptr_t count = length();
@@ -1523,7 +1470,6 @@ const CodeDescriptor* CodeLookupTable::FindCode(uword pc) const {
return NULL;
}
-
ProcessedSampleBuffer* SampleBuffer::BuildProcessedSampleBuffer(
SampleFilter* filter) {
ASSERT(filter != NULL);
@@ -1574,7 +1520,6 @@ ProcessedSampleBuffer* SampleBuffer::BuildProcessedSampleBuffer(
return buffer;
}
-
ProcessedSample* SampleBuffer::BuildProcessedSample(
Sample* sample,
const CodeLookupTable& clt) {
@@ -1619,7 +1564,6 @@ ProcessedSample* SampleBuffer::BuildProcessedSample(
return processed_sample;
}
-
Sample* SampleBuffer::Next(Sample* sample) {
if (!sample->is_continuation_sample()) return NULL;
Sample* next_sample = At(sample->continuation_index());
@@ -1638,7 +1582,6 @@ Sample* SampleBuffer::Next(Sample* sample) {
return next_sample;
}
-
ProcessedSample::ProcessedSample()
: pcs_(kSampleSize),
timestamp_(0),
@@ -1648,7 +1591,6 @@ ProcessedSample::ProcessedSample()
truncated_(false),
timeline_trie_(NULL) {}
-
void ProcessedSample::FixupCaller(const CodeLookupTable& clt,
uword pc_marker,
uword* stack_buffer) {
@@ -1664,7 +1606,6 @@ void ProcessedSample::FixupCaller(const CodeLookupTable& clt,
CheckForMissingDartFrame(clt, cd, pc_marker, stack_buffer);
}
-
void ProcessedSample::CheckForMissingDartFrame(const CodeLookupTable& clt,
const CodeDescriptor* cd,
uword pc_marker,
@@ -1719,7 +1660,6 @@ void ProcessedSample::CheckForMissingDartFrame(const CodeLookupTable& clt,
}
}
-
ProcessedSampleBuffer::ProcessedSampleBuffer()
: code_lookup_table_(new CodeLookupTable(Thread::Current())) {
ASSERT(code_lookup_table_ != NULL);
« no previous file with comments | « runtime/vm/profiler.h ('k') | runtime/vm/profiler_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698