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

Unified Diff: ppapi/native_client/src/trusted/plugin/utility.h

Issue 7740059: Add a timestamp to the log messages of NaCl's plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for fix. Created 9 years, 3 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 | « ppapi/native_client/src/trusted/plugin/module_ppapi.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/trusted/plugin/utility.h
diff --git a/ppapi/native_client/src/trusted/plugin/utility.h b/ppapi/native_client/src/trusted/plugin/utility.h
index efd4e75eb1c543b0b752cd2e0044713e242de0b5..e670d8cc7b6bf8cc9a78478c0de53954f9a3c0d9 100644
--- a/ppapi/native_client/src/trusted/plugin/utility.h
+++ b/ppapi/native_client/src/trusted/plugin/utility.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 The Native Client Authors. All rights reserved.
+ * Copyright (c) 2011 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,6 +12,7 @@
#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/include/portability.h"
#include "native_client/src/shared/platform/nacl_threads.h"
+#include "native_client/src/shared/platform/nacl_time.h"
#define SRPC_PLUGIN_DEBUG 1
@@ -32,20 +33,35 @@ extern int NaClPluginPrintLog(const char *format, ...);
extern int NaClPluginDebugPrintCheckEnv();
extern FILE* NaClPluginLogFileEnv();
#if SRPC_PLUGIN_DEBUG
-# define PLUGIN_PRINTF(args) do { \
+#define INIT_PLUGIN_LOGGING() do { \
if (-1 == ::plugin::gNaClPluginDebugPrintEnabled) { \
::plugin::gNaClPluginDebugPrintEnabled = \
::plugin::NaClPluginDebugPrintCheckEnv(); \
::plugin::gNaClPluginLogFile = ::plugin::NaClPluginLogFileEnv();\
} \
+} while (0)
+
+#define PLUGIN_PRINTF(args) do { \
+ INIT_PLUGIN_LOGGING(); \
+ if (0 != ::plugin::gNaClPluginDebugPrintEnabled) { \
+ ::plugin::NaClPluginPrintLog("PLUGIN %"NACL_PRIu64": ", \
+ NaClGetTimeOfDayMicroseconds()); \
+ ::plugin::NaClPluginPrintLog args; \
+ } \
+ } while (0)
+
+// MODULE_PRINTF is used in the module because PLUGIN_PRINTF uses a
+// a timer that may not yet be initialized.
+#define MODULE_PRINTF(args) do { \
+ INIT_PLUGIN_LOGGING(); \
if (0 != ::plugin::gNaClPluginDebugPrintEnabled) { \
- ::plugin::NaClPluginPrintLog("%08"NACL_PRIx32": ", \
- NaClThreadId()); \
+ ::plugin::NaClPluginPrintLog("MODULE: "); \
::plugin::NaClPluginPrintLog args; \
} \
} while (0)
#else
# define PLUGIN_PRINTF(args) do { if (0) { printf args; } } while (0)
+# define MODULE_PRINTF(args) do { if (0) { printf args; } } while (0)
/* allows DCE but compiler can still do format string checks */
#endif
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/module_ppapi.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698