Bug 1348031: Part 1 - Allow specifying fractional-millisecond startup profiling interval. r?mstange
MozReview-Commit-ID: Ga1ebO03gp5
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -34,16 +34,17 @@
#include "nsDirectoryServiceDefs.h"
#include "nsMemoryReporterManager.h"
#include "nsXULAppAPI.h"
#include "nsProfilerStartParams.h"
#include "mozilla/Services.h"
#include "nsThreadUtils.h"
#include "ProfilerMarkerPayload.h"
#include "shared-libraries.h"
+#include "prdtoa.h"
#include "prtime.h"
#ifdef MOZ_TASK_TRACER
#include "GeckoTaskTracer.h"
#endif
#if defined(GP_OS_android)
# include "FennecJNINatives.h"
@@ -2069,23 +2070,23 @@ profiler_init(void* aStackTop)
entries = strtol(startupEntries, nullptr, 10);
if (errno == 0 && entries > 0) {
LOG("- MOZ_PROFILER_STARTUP_ENTRIES = %d", entries);
} else {
PrintUsageThenExit(1);
}
}
- int interval = PROFILER_DEFAULT_INTERVAL;
+ double interval = PROFILER_DEFAULT_INTERVAL;
const char* startupInterval = getenv("MOZ_PROFILER_STARTUP_INTERVAL");
if (startupInterval) {
errno = 0;
- interval = strtol(startupInterval, nullptr, 10);
- if (errno == 0 && 1 <= interval && interval <= 1000) {
- LOG("- MOZ_PROFILER_STARTUP_INTERVAL = %d", interval);
+ interval = PR_strtod(startupInterval, nullptr);
+ if (errno == 0 && interval > 0.0 && interval <= 1000.0) {
+ LOG("- MOZ_PROFILER_STARTUP_INTERVAL = %f", interval);
} else {
PrintUsageThenExit(1);
}
}
locked_profiler_start(lock, entries, interval, features,
filters, MOZ_ARRAY_LENGTH(filters));
}