Bug 764021 - Cleanup Android use of StartupTimeline. r=blassey

This commit is contained in:
Mike Hommey 2012-06-19 09:16:33 +02:00
Родитель 224849e3a5
Коммит 57d4e689d9
1 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -62,6 +62,7 @@ extern "C" {
}
typedef int mozglueresult;
typedef int64_t MOZTime;
enum StartupEvent {
#define mozilla_StartupTimeline_Event(ev, z) ev,
@ -72,11 +73,11 @@ enum StartupEvent {
using namespace mozilla;
static uint64_t *sStartupTimeline;
void StartupTimeline_Record(StartupEvent ev, struct timeval *tm)
static MOZTime MOZ_Now()
{
sStartupTimeline[ev] = (((uint64_t)tm->tv_sec * 1000000LL) + (uint64_t)tm->tv_usec);
struct timeval tm;
gettimeofday(&tm, 0);
return (((MOZTime)tm.tv_sec * 1000000LL) + (MOZTime)tm.tv_usec);
}
static struct mapping_info * lib_mapping = NULL;
@ -669,8 +670,7 @@ loadGeckoLibs(const char *apkName)
apk_mtime = status.st_mtime;
#endif
struct timeval t0, t1;
gettimeofday(&t0, 0);
MOZTime t0 = MOZ_Now();
struct rusage usage1;
getrusage(RUSAGE_THREAD, &usage1);
@ -742,18 +742,18 @@ loadGeckoLibs(const char *apkName)
GETFUNC(onFullScreenPluginHidden);
GETFUNC(getNextMessageFromQueue);
#undef GETFUNC
sStartupTimeline = (uint64_t *) (uintptr_t) __wrap_dlsym(xul_handle, "_ZN7mozilla15StartupTimeline16sStartupTimelineE");
gettimeofday(&t1, 0);
void (*XRE_StartupTimelineRecord)(int, MOZTime) = (void (*)(int, MOZTime)) __wrap_dlsym(xul_handle, "XRE_StartupTimelineRecord");
MOZTime t1 = MOZ_Now();
struct rusage usage2;
getrusage(RUSAGE_THREAD, &usage2);
__android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Loaded libs in %ldms total, %ldms user, %ldms system, %ld faults",
(t1.tv_sec - t0.tv_sec)*1000 + (t1.tv_usec - t0.tv_usec)/1000,
(t1 - t0) / 1000,
(usage2.ru_utime.tv_sec - usage1.ru_utime.tv_sec)*1000 + (usage2.ru_utime.tv_usec - usage1.ru_utime.tv_usec)/1000,
(usage2.ru_stime.tv_sec - usage1.ru_stime.tv_sec)*1000 + (usage2.ru_stime.tv_usec - usage1.ru_stime.tv_usec)/1000,
usage2.ru_majflt-usage1.ru_majflt);
StartupTimeline_Record(LINKER_INITIALIZED, &t0);
StartupTimeline_Record(LIBRARIES_LOADED, &t1);
XRE_StartupTimelineRecord(LINKER_INITIALIZED, t0);
XRE_StartupTimelineRecord(LIBRARIES_LOADED, t1);
return SUCCESS;
}