Index: tools/cygprofile/cygprofile.cc |
diff --git a/tools/cygprofile/cygprofile.cc b/tools/cygprofile/cygprofile.cc |
index 1c4136f9d459a4484daf5acf87d33f7d44f8e9fc..652d489e759fbb493483e8264b6789e67aa92b5d 100644 |
--- a/tools/cygprofile/cygprofile.cc |
+++ b/tools/cygprofile/cygprofile.cc |
@@ -32,9 +32,9 @@ |
#include <sys/syscall.h> |
#include <sys/time.h> |
#include <sys/types.h> |
-#include <unordered_set> |
#include <vector> |
+#include "base/hash_tables.h" |
#include "base/lazy_instance.h" |
#include "base/logging.h" |
#include "base/memory/singleton.h" |
@@ -131,7 +131,7 @@ class CygTlsLog { |
// Keeps track of all functions that have been logged on this thread |
// so we do not record dublicates. |
- std::unordered_set<void*> functions_called_; |
+ std::hash_set<void*> functions_called_; |
// Thread identifier as Linux kernel shows it. For debugging purposes. |
// LWP (light-weight process) is a unique ID of the thread in the system, |
@@ -152,7 +152,7 @@ struct AllLogs { |
base::LazyInstance<AllLogs>::Leaky all_logs_ = LAZY_INSTANCE_INITIALIZER; |
// Per-thread pointer to the current log object. |
-__thread CygTlsLog* tls_current_log = NULL; |
+static __thread CygTlsLog* tls_current_log = NULL; |
// Magic value of above to prevent the instrumentation. Used when CygTlsLog is |
// being constructed (to prevent reentering by malloc, for example) and by |
@@ -164,7 +164,12 @@ CygTlsLog* const kMagicBeingConstructed = reinterpret_cast<CygTlsLog*>(1); |
const int CygTlsLog::kBufMaxSize = 3000; |
// "cyglog.PID.LWP.pthread_self.PPID" |
+#if defined(OS_ANDROID) |
bulach
2012/12/03 16:48:30
maybe splitting this would be nicer:
#if defined(
felipeg
2012/12/03 16:56:44
Done.
|
+const char CygTlsLog::kLogFilenameFmt[] = |
+ "/data/local/tmp/chrome/cyglog/cyglog.%d.%d.%ld-%d"; |
+#else |
const char CygTlsLog::kLogFilenameFmt[] = "/var/log/chrome/cyglog.%d.%d.%ld-%d"; |
+#endif |
CygCommon* CygCommon::GetInstance() { |
return Singleton<CygCommon>::get(); |
@@ -281,9 +286,12 @@ void CygTlsLog::AddNewLog(CygTlsLog* newlog) { |
AllLogs& all_logs = all_logs_.Get(); |
base::AutoLock lock(all_logs.mutex); |
if (all_logs.logs.empty()) { |
+ |
+#if !defined(OS_ANDROID) |
glotov
2012/12/03 16:42:17
Could you please make a simple test that verifies
felipeg
2012/12/03 16:56:44
Done.
glotov
2012/12/03 17:10:08
Well, actually it is up to you. Are you 100% sure
felipeg
2012/12/03 18:51:20
I am 100% sure that we don't fork and we will neve
|
CHECK(!pthread_atfork(CygTlsLog::AtForkPrepare, |
CygTlsLog::AtForkParent, |
CygTlsLog::AtForkChild)); |
+#endif |
// The very first process starts its flush thread here. Forked processes |
// will do it in AtForkChild(). |
@@ -304,7 +312,6 @@ static void WriteLogLine(int fd, const char* fmt, ...) { |
void CygTlsLog::FlushLog() { |
bool first_log_write = false; |
- |
if (log_filename_.empty()) { |
first_log_write = true; |
char buf[80]; |