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

Unified Diff: src/oprofile-agent.cc

Issue 1317003: Align OProfile agent invocations style with logging. (Closed)
Patch Set: Created 10 years, 9 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 | « src/oprofile-agent.h ('k') | src/platform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/oprofile-agent.cc
diff --git a/src/oprofile-agent.cc b/src/oprofile-agent.cc
index 8aa3937f90df8dba98e3ab530acdc6166252be95..6df8f503c922c5dff75435f466ccd0e06d55eda7 100644
--- a/src/oprofile-agent.cc
+++ b/src/oprofile-agent.cc
@@ -32,10 +32,6 @@
namespace v8 {
namespace internal {
-#ifdef ENABLE_OPROFILE_AGENT
-op_agent_t OProfileAgent::handle_ = NULL;
-#endif
-
bool OProfileAgent::Initialize() {
#ifdef ENABLE_OPROFILE_AGENT
@@ -70,47 +66,43 @@ void OProfileAgent::TearDown() {
}
+#ifdef ENABLE_OPROFILE_AGENT
+op_agent_t OProfileAgent::handle_ = NULL;
+
+
void OProfileAgent::CreateNativeCodeRegion(const char* name,
const void* ptr, unsigned int size) {
-#ifdef ENABLE_OPROFILE_AGENT
- if (handle_ == NULL) return;
op_write_native_code(handle_, name, (uint64_t)ptr, ptr, size);
-#endif
}
void OProfileAgent::CreateNativeCodeRegion(String* name,
const void* ptr, unsigned int size) {
-#ifdef ENABLE_OPROFILE_AGENT
- if (handle_ != NULL) {
- const char* func_name;
- SmartPointer<char> str =
- name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
- func_name = name->length() > 0 ? *str : "<anonymous>";
- CreateNativeCodeRegion(func_name, ptr, size);
- }
-#endif
+ const char* func_name;
+ SmartPointer<char> str =
+ name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
+ func_name = name->length() > 0 ? *str : "<anonymous>";
+ CreateNativeCodeRegion(func_name, ptr, size);
}
void OProfileAgent::CreateNativeCodeRegion(String* name, String* source,
int line_num, const void* ptr, unsigned int size) {
-#ifdef ENABLE_OPROFILE_AGENT
- if (handle_ != NULL) {
- Vector<char> buf = Vector<char>::New(OProfileAgent::kFormattingBufSize);
- const char* func_name;
- SmartPointer<char> str =
- name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
- func_name = name->length() > 0 ? *str : "<anonymous>";
- SmartPointer<char> source_str =
- source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
- if (v8::internal::OS::SNPrintF(buf, "%s %s:%d",
- func_name, *source_str, line_num) != -1) {
- CreateNativeCodeRegion(buf.start(), ptr, size);
- } else {
- CreateNativeCodeRegion("<script/func name too long>", ptr, size);
- }
+ Vector<char> buf = Vector<char>::New(OProfileAgent::kFormattingBufSize);
+ const char* func_name;
+ SmartPointer<char> str =
+ name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
+ func_name = name->length() > 0 ? *str : "<anonymous>";
+ SmartPointer<char> source_str =
+ source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
+ if (v8::internal::OS::SNPrintF(buf, "%s %s:%d",
+ func_name, *source_str, line_num) != -1) {
+ CreateNativeCodeRegion(buf.start(), ptr, size);
+ } else {
+ CreateNativeCodeRegion("<script/func name too long>", ptr, size);
}
-#endif
}
-} }
+
+#endif // ENABLE_OPROFILE_AGENT
+
+} } // namespace v8::internal
« no previous file with comments | « src/oprofile-agent.h ('k') | src/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698