From: Wang Yu <yuw...@linux.alibaba.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

add boot_time event of uncompress lzloader.elf

sometimes i found uncompres cost serival times,
so add boot_time event of uncompress lzloader.elf
after patch
        ...
        disk read (real mode): 45.09ms, (+45.09ms)
        uncompress lzloader.elf: 76.90ms, (+31.81ms)
        TLS initialization: 77.65ms, (+0.75ms)
        .init functions: 82.69ms, (+5.04ms)
        SMP launched: 83.72ms, (+1.03ms)
        VFS initialized: 88.67ms, (+4.95ms)
        ...

Signed-off-by: Wang Yu <yuw...@linux.alibaba.com>
Message-Id: <1523516894-14812-2-git-send-email-yuw...@linux.alibaba.com>

---
diff --git a/arch/x64/arch-setup.cc b/arch/x64/arch-setup.cc
--- a/arch/x64/arch-setup.cc
+++ b/arch/x64/arch-setup.cc
@@ -50,6 +50,7 @@ struct osv_multiboot_info_type {
     struct multiboot_info_type mb;
     u32 tsc_init, tsc_init_hi;
     u32 tsc_disk_done, tsc_disk_done_hi;
+    u32 tsc_uncompress_done, tsc_uncompress_done_hi;
     u8 disk_err;
 } __attribute__((packed));

@@ -140,6 +141,10 @@ void arch_setup_free_memory()
     time = (time << 32) | omb.tsc_disk_done;
     boot_time.event(1, "disk read (real mode)", time );

+    time = omb.tsc_uncompress_done_hi;
+    time = (time << 32) | omb.tsc_uncompress_done;
+    boot_time.event(2, "uncompress lzloader.elf", time );
+
     auto c = processor::cpuid(0x80000000);
     if (c.a >= 0x80000008) {
         c = processor::cpuid(0x80000008);
diff --git a/arch/x64/boot16.S b/arch/x64/boot16.S
--- a/arch/x64/boot16.S
+++ b/arch/x64/boot16.S
@@ -20,7 +20,9 @@ mb_tsc1_lo = (mb_info + 88)
 mb_tsc1_hi = (mb_info + 88 + 4)
 mb_tsc_disk_lo = (mb_info + 88 + 8)
 mb_tsc_disk_hi = (mb_info + 88 + 12)
-mb_disk_err = (mb_info + 88 + 16)
+mb_uncompress_lo = (mb_info + 88 + 16)
+mb_uncompress_hi = (mb_info + 88 + 20)
+mb_disk_err = (mb_info + 88 + 24)
 mb_cmdline = (mb_info + 16)
 mb_mmap_len = (mb_info + 44)
 mb_mmap_addr = (mb_info + 48)
@@ -161,6 +163,9 @@ done_e820:
     mov %eax, %fs
     mov %eax, %ss
     call *lzentry
+    rdtsc
+    mov %eax, mb_uncompress_lo
+    mov %edx, mb_uncompress_hi
     mov $loader, %eax
     mov $mb_info, %ebx
     call *entry
diff --git a/include/osv/boot.hh b/include/osv/boot.hh
--- a/include/osv/boot.hh
+++ b/include/osv/boot.hh
@@ -21,7 +21,7 @@ private:
// relatively late (the code that takes the measure is so early it cannot // call this one directly. Therefore, the measurements would appear in the
     // middle of the list, and we want to preserve order.
-    int _event = 3;
+    int _event = 4;
     time_element arrays[16];

     void print_one_time(int index);
diff --git a/loader.cc b/loader.cc
--- a/loader.cc
+++ b/loader.cc
@@ -109,7 +109,7 @@ void premain()
     }

     setup_tls(inittab);
-    boot_time.event(2,"TLS initialization");
+    boot_time.event(3,"TLS initialization");
for (auto init = inittab.start; init < inittab.start + inittab.count; ++init) {
         (*init)();
     }

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to