Bug 702764 part 3 - Add linker initialization and library loading timestamps for nsAppStartup::GetStartupInfo. r=tglek

This commit is contained in:
Mike Hommey 2011-11-18 08:54:37 +01:00
Родитель 89d7e38ce7
Коммит 2ca8a93ed5
3 изменённых файлов: 21 добавлений и 0 удалений

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

@ -72,6 +72,19 @@
#define DEFLATE 8 #define DEFLATE 8
#define LZMA 14 #define LZMA 14
enum StartupEvent {
#define mozilla_StartupTimeline_Event(ev, z) ev,
#include "StartupTimeline.h"
#undef mozilla_StartupTimeline_Event
};
static uint64_t *sStartupTimeline;
void StartupTimeline_Record(StartupEvent ev, struct timeval *tm)
{
sStartupTimeline[ev] = (((uint64_t)tm->tv_sec * 1000000LL) + (uint64_t)tm->tv_usec);
}
struct local_file_header { struct local_file_header {
uint32_t signature; uint32_t signature;
uint16_t min_version; uint16_t min_version;
@ -650,6 +663,7 @@ loadLibs(const char *apkName)
GETFUNC(cameraCallbackBridge); GETFUNC(cameraCallbackBridge);
GETFUNC(notifyBatteryChange); GETFUNC(notifyBatteryChange);
#undef GETFUNC #undef GETFUNC
sStartupTimeline = (uint64_t *)__wrap_dlsym(xul_handle, "_ZN7mozilla15StartupTimeline16sStartupTimelineE");
gettimeofday(&t1, 0); gettimeofday(&t1, 0);
struct rusage usage2; struct rusage usage2;
getrusage(RUSAGE_THREAD, &usage2); getrusage(RUSAGE_THREAD, &usage2);
@ -658,6 +672,9 @@ loadLibs(const char *apkName)
(usage2.ru_utime.tv_sec - usage1.ru_utime.tv_sec)*1000 + (usage2.ru_utime.tv_usec - usage1.ru_utime.tv_usec)/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_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); usage2.ru_majflt-usage1.ru_majflt);
StartupTimeline_Record(LINKER_INITIALIZED, &t0);
StartupTimeline_Record(LIBRARIES_LOADED, &t1);
} }
extern "C" NS_EXPORT void JNICALL extern "C" NS_EXPORT void JNICALL

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

@ -76,6 +76,8 @@ CSRCS = \
rt.c \ rt.c \
$(NULL) $(NULL)
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/components/startup
EXPORTS = APKOpen.h EXPORTS = APKOpen.h
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

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

@ -41,6 +41,8 @@ mozilla_StartupTimeline_Event(MAIN, "main")
mozilla_StartupTimeline_Event(FIRST_PAINT, "firstPaint") mozilla_StartupTimeline_Event(FIRST_PAINT, "firstPaint")
mozilla_StartupTimeline_Event(SESSION_RESTORED, "sessionRestored") mozilla_StartupTimeline_Event(SESSION_RESTORED, "sessionRestored")
mozilla_StartupTimeline_Event(CREATE_TOP_LEVEL_WINDOW, "createTopLevelWindow") mozilla_StartupTimeline_Event(CREATE_TOP_LEVEL_WINDOW, "createTopLevelWindow")
mozilla_StartupTimeline_Event(LINKER_INITIALIZED, "linkerInitialized")
mozilla_StartupTimeline_Event(LIBRARIES_LOADED, "librariesLoaded")
#else #else
#ifndef mozilla_StartupTimeline #ifndef mozilla_StartupTimeline