package/pkg-generic.mk: increase precision of timestamps
authorThomas Petazzoni <thomas.petazzoni@bootlin.com>
Fri, 21 Sep 2018 13:31:16 +0000 (15:31 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Wed, 10 Oct 2018 19:30:51 +0000 (21:30 +0200)
Currently, the timestamps that we keep in build-time.log use a
second-level precision. However, as we are going to introduce a new
type of graph to draw the time line of a build, this precision is
going to be insufficient, as a number of steps are so short that they
are not even one second long, and generally the rounding to the second
gives a not so great looking graph.

Therefore, we add to the timestamps the nanoseconds using the %N date
specifier. A milli-second precision would have been sufficient, but %N
is all what date(1) provides at the sub-second level.

Since this is changing the format of the build-time.log file, this
commit adjusts the support/scripts/graph-build-time script
accordingly, to account for the floating point numbers that we have as
timestamps.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/pkg-generic.mk
support/scripts/graph-build-time

index 91b61c6de093a90a61baa3016c07defbfd7ad85c..daf24594deea8de20fac103093111dd1addc2ba6 100644 (file)
@@ -50,7 +50,7 @@ endef
 # Time steps
 define step_time
        printf "%s:%-5.5s:%-20.20s: %s\n"           \
-              "$$(date +%s)" "$(1)" "$(2)" "$(3)"  \
+              "$$(date +%s.%N)" "$(1)" "$(2)" "$(3)"  \
               >>"$(BUILD_DIR)/build-time.log"
 endef
 GLOBAL_INSTRUMENTATION_HOOKS += step_time
index 415d431f236f8f3bbdd51a541837854b58181452..892e08bf0757660fbb0df164752bea7953a2d219 100755 (executable)
@@ -260,7 +260,7 @@ def read_data(input_file):
         return None
 
     for row in reader:
-        time = int(row[0].strip())
+        time = float(row[0].strip())
         state = row[1].strip()
         step = row[2].strip()
         pkg = row[3].strip()