|
|
6ca8db |
diff -up mozilla-esr24/xpcom/ds/TimeStamp.cpp.906754 mozilla-esr24/xpcom/ds/TimeStamp.cpp
|
|
|
6ca8db |
--- mozilla-esr24/xpcom/ds/TimeStamp.cpp.906754 2013-12-06 03:21:33.000000000 +0100
|
|
|
6ca8db |
+++ mozilla-esr24/xpcom/ds/TimeStamp.cpp 2013-12-20 16:11:06.607243958 +0100
|
|
|
6ca8db |
@@ -13,15 +13,41 @@
|
|
|
6ca8db |
|
|
|
6ca8db |
namespace mozilla {
|
|
|
6ca8db |
|
|
|
6ca8db |
-TimeStamp TimeStamp::sFirstTimeStamp;
|
|
|
6ca8db |
-TimeStamp TimeStamp::sProcessCreation;
|
|
|
6ca8db |
+/**
|
|
|
6ca8db |
+ * Wrapper class used to initialize static data used by the TimeStamp class
|
|
|
6ca8db |
+ */
|
|
|
6ca8db |
+struct TimeStampInitialization {
|
|
|
6ca8db |
+ /**
|
|
|
6ca8db |
+ * First timestamp taken when the class static initializers are run. This
|
|
|
6ca8db |
+ * timestamp is used to sanitize timestamps coming from different sources.
|
|
|
6ca8db |
+ */
|
|
|
6ca8db |
+ TimeStamp mFirstTimeStamp;
|
|
|
6ca8db |
+
|
|
|
6ca8db |
+ /**
|
|
|
6ca8db |
+ * Timestamp representing the time when the process was created. This field
|
|
|
6ca8db |
+ * is populated lazily the first time this information is required and is
|
|
|
6ca8db |
+ * replaced every time the process is restarted.
|
|
|
6ca8db |
+ */
|
|
|
6ca8db |
+ TimeStamp mProcessCreation;
|
|
|
6ca8db |
+
|
|
|
6ca8db |
+ TimeStampInitialization() {
|
|
|
6ca8db |
+ TimeStamp::Startup();
|
|
|
6ca8db |
+ mFirstTimeStamp = TimeStamp::Now();
|
|
|
6ca8db |
+ };
|
|
|
6ca8db |
+
|
|
|
6ca8db |
+ ~TimeStampInitialization() {
|
|
|
6ca8db |
+ TimeStamp::Shutdown();
|
|
|
6ca8db |
+ };
|
|
|
6ca8db |
+};
|
|
|
6ca8db |
+
|
|
|
6ca8db |
+static TimeStampInitialization sInitOnce;
|
|
|
6ca8db |
|
|
|
6ca8db |
TimeStamp
|
|
|
6ca8db |
TimeStamp::ProcessCreation(bool& aIsInconsistent)
|
|
|
6ca8db |
{
|
|
|
6ca8db |
aIsInconsistent = false;
|
|
|
6ca8db |
|
|
|
6ca8db |
- if (sProcessCreation.IsNull()) {
|
|
|
6ca8db |
+ if (sInitOnce.mProcessCreation.IsNull()) {
|
|
|
6ca8db |
char *mozAppRestart = PR_GetEnv("MOZ_APP_RESTART");
|
|
|
6ca8db |
TimeStamp ts;
|
|
|
6ca8db |
|
|
|
6ca8db |
@@ -31,7 +57,7 @@ TimeStamp::ProcessCreation(bool& aIsInco
|
|
|
6ca8db |
if (mozAppRestart && (strcmp(mozAppRestart, "") != 0)) {
|
|
|
6ca8db |
/* Firefox was restarted, use the first time-stamp we've taken as the new
|
|
|
6ca8db |
* process startup time and unset MOZ_APP_RESTART. */
|
|
|
6ca8db |
- ts = sFirstTimeStamp;
|
|
|
6ca8db |
+ ts = sInitOnce.mFirstTimeStamp;
|
|
|
6ca8db |
PR_SetEnv("MOZ_APP_RESTART=");
|
|
|
6ca8db |
} else {
|
|
|
6ca8db |
TimeStamp now = Now();
|
|
|
6ca8db |
@@ -39,26 +65,26 @@ TimeStamp::ProcessCreation(bool& aIsInco
|
|
|
6ca8db |
|
|
|
6ca8db |
ts = now - TimeDuration::FromMicroseconds(uptime);
|
|
|
6ca8db |
|
|
|
6ca8db |
- if ((ts > sFirstTimeStamp) || (uptime == 0)) {
|
|
|
6ca8db |
+ if ((ts > sInitOnce.mFirstTimeStamp) || (uptime == 0)) {
|
|
|
6ca8db |
/* If the process creation timestamp was inconsistent replace it with
|
|
|
6ca8db |
* the first one instead and notify that a telemetry error was
|
|
|
6ca8db |
* detected. */
|
|
|
6ca8db |
aIsInconsistent = true;
|
|
|
6ca8db |
- ts = sFirstTimeStamp;
|
|
|
6ca8db |
+ ts = sInitOnce.mFirstTimeStamp;
|
|
|
6ca8db |
}
|
|
|
6ca8db |
}
|
|
|
6ca8db |
|
|
|
6ca8db |
- sProcessCreation = ts;
|
|
|
6ca8db |
+ sInitOnce.mProcessCreation = ts;
|
|
|
6ca8db |
}
|
|
|
6ca8db |
|
|
|
6ca8db |
- return sProcessCreation;
|
|
|
6ca8db |
+ return sInitOnce.mProcessCreation;
|
|
|
6ca8db |
}
|
|
|
6ca8db |
|
|
|
6ca8db |
void
|
|
|
6ca8db |
TimeStamp::RecordProcessRestart()
|
|
|
6ca8db |
{
|
|
|
6ca8db |
PR_SetEnv("MOZ_APP_RESTART=1");
|
|
|
6ca8db |
- sProcessCreation = TimeStamp();
|
|
|
6ca8db |
+ sInitOnce.mProcessCreation = TimeStamp();
|
|
|
6ca8db |
}
|
|
|
6ca8db |
|
|
|
6ca8db |
} // namespace mozilla
|
|
|
6ca8db |
diff -up mozilla-esr24/xpcom/ds/TimeStamp_darwin.cpp.906754 mozilla-esr24/xpcom/ds/TimeStamp_darwin.cpp
|
|
|
6ca8db |
--- mozilla-esr24/xpcom/ds/TimeStamp_darwin.cpp.906754 2013-12-06 03:21:33.000000000 +0100
|
|
|
6ca8db |
+++ mozilla-esr24/xpcom/ds/TimeStamp_darwin.cpp 2013-12-20 15:58:50.356993425 +0100
|
|
|
6ca8db |
@@ -114,18 +114,6 @@ TimeDuration::Resolution()
|
|
|
6ca8db |
return TimeDuration::FromTicks(int64_t(sResolution));
|
|
|
6ca8db |
}
|
|
|
6ca8db |
|
|
|
6ca8db |
-struct TimeStampInitialization
|
|
|
6ca8db |
-{
|
|
|
6ca8db |
- TimeStampInitialization() {
|
|
|
6ca8db |
- TimeStamp::Startup();
|
|
|
6ca8db |
- }
|
|
|
6ca8db |
- ~TimeStampInitialization() {
|
|
|
6ca8db |
- TimeStamp::Shutdown();
|
|
|
6ca8db |
- }
|
|
|
6ca8db |
-};
|
|
|
6ca8db |
-
|
|
|
6ca8db |
-static TimeStampInitialization initOnce;
|
|
|
6ca8db |
-
|
|
|
6ca8db |
nsresult
|
|
|
6ca8db |
TimeStamp::Startup()
|
|
|
6ca8db |
{
|
|
|
6ca8db |
@@ -152,8 +140,6 @@ TimeStamp::Startup()
|
|
|
6ca8db |
sResolutionSigDigs *= 10);
|
|
|
6ca8db |
|
|
|
6ca8db |
gInitialized = true;
|
|
|
6ca8db |
- sFirstTimeStamp = TimeStamp::Now();
|
|
|
6ca8db |
- sProcessCreation = TimeStamp();
|
|
|
6ca8db |
|
|
|
6ca8db |
return NS_OK;
|
|
|
6ca8db |
}
|
|
|
6ca8db |
diff -up mozilla-esr24/xpcom/ds/TimeStamp.h.906754 mozilla-esr24/xpcom/ds/TimeStamp.h
|
|
|
6ca8db |
--- mozilla-esr24/xpcom/ds/TimeStamp.h.906754 2013-12-06 03:21:33.000000000 +0100
|
|
|
6ca8db |
+++ mozilla-esr24/xpcom/ds/TimeStamp.h 2013-12-20 15:58:50.356993425 +0100
|
|
|
6ca8db |
@@ -363,19 +363,6 @@ private:
|
|
|
6ca8db |
* When using a system clock, a value is system dependent.
|
|
|
6ca8db |
*/
|
|
|
6ca8db |
TimeStampValue mValue;
|
|
|
6ca8db |
-
|
|
|
6ca8db |
- /**
|
|
|
6ca8db |
- * First timestamp taken when the class static initializers are run. This
|
|
|
6ca8db |
- * timestamp is used to sanitize timestamps coming from different sources.
|
|
|
6ca8db |
- */
|
|
|
6ca8db |
- static TimeStamp sFirstTimeStamp;
|
|
|
6ca8db |
-
|
|
|
6ca8db |
- /**
|
|
|
6ca8db |
- * Timestamp representing the time when the process was created. This field
|
|
|
6ca8db |
- * is populated lazily the first time this information is required and is
|
|
|
6ca8db |
- * replaced every time the process is restarted.
|
|
|
6ca8db |
- */
|
|
|
6ca8db |
- static TimeStamp sProcessCreation;
|
|
|
6ca8db |
};
|
|
|
6ca8db |
|
|
|
6ca8db |
}
|
|
|
6ca8db |
diff -up mozilla-esr24/xpcom/ds/TimeStamp_posix.cpp.906754 mozilla-esr24/xpcom/ds/TimeStamp_posix.cpp
|
|
|
6ca8db |
--- mozilla-esr24/xpcom/ds/TimeStamp_posix.cpp.906754 2013-12-06 03:21:33.000000000 +0100
|
|
|
6ca8db |
+++ mozilla-esr24/xpcom/ds/TimeStamp_posix.cpp 2013-12-20 15:58:50.356993425 +0100
|
|
|
6ca8db |
@@ -159,17 +159,6 @@ TimeDuration::Resolution()
|
|
|
6ca8db |
return TimeDuration::FromTicks(int64_t(sResolution));
|
|
|
6ca8db |
}
|
|
|
6ca8db |
|
|
|
6ca8db |
-struct TimeStampInitialization
|
|
|
6ca8db |
-{
|
|
|
6ca8db |
- TimeStampInitialization() {
|
|
|
6ca8db |
- TimeStamp::Startup();
|
|
|
6ca8db |
- }
|
|
|
6ca8db |
- ~TimeStampInitialization() {
|
|
|
6ca8db |
- TimeStamp::Shutdown();
|
|
|
6ca8db |
- }
|
|
|
6ca8db |
-};
|
|
|
6ca8db |
-
|
|
|
6ca8db |
-static TimeStampInitialization initOnce;
|
|
|
6ca8db |
static bool gInitialized = false;
|
|
|
6ca8db |
|
|
|
6ca8db |
nsresult
|
|
|
6ca8db |
@@ -192,8 +181,6 @@ TimeStamp::Startup()
|
|
|
6ca8db |
sResolutionSigDigs *= 10);
|
|
|
6ca8db |
|
|
|
6ca8db |
gInitialized = true;
|
|
|
6ca8db |
- sFirstTimeStamp = TimeStamp::Now();
|
|
|
6ca8db |
- sProcessCreation = TimeStamp();
|
|
|
6ca8db |
|
|
|
6ca8db |
return NS_OK;
|
|
|
6ca8db |
}
|
|
|
6ca8db |
diff -up mozilla-esr24/xpcom/ds/TimeStamp_windows.cpp.906754 mozilla-esr24/xpcom/ds/TimeStamp_windows.cpp
|
|
|
6ca8db |
--- mozilla-esr24/xpcom/ds/TimeStamp_windows.cpp.906754 2013-12-06 03:21:33.000000000 +0100
|
|
|
6ca8db |
+++ mozilla-esr24/xpcom/ds/TimeStamp_windows.cpp 2013-12-20 15:58:50.357993430 +0100
|
|
|
6ca8db |
@@ -457,18 +457,6 @@ TimeDuration::Resolution()
|
|
|
6ca8db |
return TimeDuration::FromTicks(int64_t(sResolution));
|
|
|
6ca8db |
}
|
|
|
6ca8db |
|
|
|
6ca8db |
-struct TimeStampInitialization
|
|
|
6ca8db |
-{
|
|
|
6ca8db |
- TimeStampInitialization() {
|
|
|
6ca8db |
- TimeStamp::Startup();
|
|
|
6ca8db |
- }
|
|
|
6ca8db |
- ~TimeStampInitialization() {
|
|
|
6ca8db |
- TimeStamp::Shutdown();
|
|
|
6ca8db |
- }
|
|
|
6ca8db |
-};
|
|
|
6ca8db |
-
|
|
|
6ca8db |
-static TimeStampInitialization initOnce;
|
|
|
6ca8db |
-
|
|
|
6ca8db |
static bool
|
|
|
6ca8db |
HasStableTSC()
|
|
|
6ca8db |
{
|
|
|
6ca8db |
@@ -534,8 +522,6 @@ TimeStamp::Startup()
|
|
|
6ca8db |
|
|
|
6ca8db |
InitThresholds();
|
|
|
6ca8db |
InitResolution();
|
|
|
6ca8db |
- sFirstTimeStamp = TimeStamp::Now();
|
|
|
6ca8db |
- sProcessCreation = TimeStamp();
|
|
|
6ca8db |
|
|
|
6ca8db |
return NS_OK;
|
|
|
6ca8db |
}
|