[前][次][番号順一覧][スレッド一覧]

ruby-changes:63679

From: Nobuyoshi <ko1@a...>
Date: Sun, 22 Nov 2020 11:39:47 +0900 (JST)
Subject: [ruby-changes:63679] 0f51105ece (master): make-snapshot: measure archiving times

https://git.ruby-lang.org/ruby.git/commit/?id=0f51105ece

From 0f51105ece36739f2d4329089e0cff7a925ea2ff Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 22 Nov 2020 11:01:17 +0900
Subject: make-snapshot: measure archiving times


diff --git a/tool/make-snapshot b/tool/make-snapshot
index ca40747..735d0f0 100755
--- a/tool/make-snapshot
+++ b/tool/make-snapshot
@@ -242,6 +242,16 @@ class MAKE < Struct.new(:prog, :args) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L242
   end
 end
 
+def measure
+  clock = Process::CLOCK_MONOTONIC
+  t0 = Process.clock_gettime(clock)
+  STDOUT.flush
+  result = yield
+  printf(" %6.3f", Process.clock_gettime(clock) - t0)
+  STDOUT.flush
+  result
+end
+
 def package(vcs, rev, destdir, tmp = nil)
   pwd = Dir.pwd
   patchlevel = false
@@ -544,7 +554,7 @@ touch-unicode-files: https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L554
       else
         tarball = ext == ".tar" ? file : "#{$archname||v}.tar"
         print "creating tarball... #{tarball}"
-        if tar_create(tarball, v)
+        if measure {tar_create(tarball, v)}
           puts $colorize.pass(" done")
           File.utime(modified, modified, tarball) if modified
           next if tarball == file
@@ -555,7 +565,7 @@ touch-unicode-files: https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L565
         end
       end
       print "creating #{mesg} tarball... #{file}"
-      done = system(*cmd, tarball, out: file)
+      done = measure {system(*cmd, tarball, out: file)}
     else
       print "creating #{mesg} archive... #{file}"
       if Hash === cmd.last
@@ -564,7 +574,7 @@ touch-unicode-files: https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L574
       else
         (cmd = cmd.dup) << file << v
       end
-      done = system(*cmd)
+      done = measure {system(*cmd)}
     end
     if done
       puts $colorize.pass(" done")
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]