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>
---
 arch/x64/arch-setup.cc | 5 +++++
 arch/x64/boot16.S      | 7 ++++++-
 include/osv/boot.hh    | 2 +-
 loader.cc              | 2 +-
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/x64/arch-setup.cc b/arch/x64/arch-setup.cc
index 325c26a..ce81437 100644
--- 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.arrays[1] = { "disk read (real mode)", time };
 
+    time = omb.tsc_uncompress_done_hi;
+    time = (time << 32) | omb.tsc_uncompress_done;
+    boot_time.arrays[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
index d8808bd..d053a3f 100644
--- 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
index ec5301c..4c67410 100644
--- a/include/osv/boot.hh
+++ b/include/osv/boot.hh
@@ -20,7 +20,7 @@ public:
     // 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;
 private:
 
     void print_one_time(int index);
diff --git a/loader.cc b/loader.cc
index 0d97151..841e146 100644
--- a/loader.cc
+++ b/loader.cc
@@ -109,7 +109,7 @@ void premain()
     }
 
     setup_tls(inittab);
-    boot_time._event=2;
+    boot_time._event=3;
     boot_time.event("TLS initialization");
     for (auto init = inittab.start; init < inittab.start + inittab.count; 
++init) {
         (*init)();
-- 
1.8.3.1

-- 
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