s390/cpum_sf: Add helper to read TOD from trailer entries
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Thu, 12 Dec 2013 16:38:50 +0000 (17:38 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 16 Dec 2013 13:37:58 +0000 (14:37 +0100)
The trailer entry contains a timestamp of the time when the sample-data-block
became full.  The timestamp specifies a TOD (time-of-day) value in either the
STCK or STCKE format.

Provide a helper function to return the TOD value depending on the setting of
time format indicator.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/cpu_mf.h
arch/s390/kernel/perf_cpum_sf.c

index b0b3059b8d6428f72c3a4ffdd38cd5229f140ed7..09dc5facc0bcc19ac9f0c0943f2954f0ab0ccfcf 100644 (file)
@@ -125,8 +125,7 @@ struct hws_trailer_entry {
                unsigned long long flags;       /* 0 - 63: All indicators     */
        };
        unsigned long long overflow;     /* 64 - sample Overflow count        */
-       unsigned long long timestamp;    /* 16 - time-stamp                   */
-       unsigned long long timestamp1;   /*                                   */
+       unsigned char timestamp[16];     /* 16 - 31 timestamp                 */
        unsigned long long reserved1;    /* 32 -Reserved                      */
        unsigned long long reserved2;    /*                                   */
        unsigned long long progusage1;   /* 48 - reserved for programming use */
@@ -232,6 +231,17 @@ static inline unsigned long sample_rate_to_freq(struct hws_qsi_info_block *qsi,
 #define SDB_TE_ALERT_REQ_MASK  0x4000000000000000UL
 #define SDB_TE_BUFFER_FULL_MASK 0x8000000000000000UL
 
+/* Return TOD timestamp contained in an trailer entry */
+static inline unsigned long long trailer_timestamp(struct hws_trailer_entry *te)
+{
+       /* TOD in STCKE format */
+       if (te->t)
+               return *((unsigned long long *) &te->timestamp[1]);
+
+       /* TOD in STCK format */
+       return *((unsigned long long *) &te->timestamp[0]);
+}
+
 /* Return pointer to trailer entry of an sample data block */
 static inline unsigned long *trailer_entry_ptr(unsigned long v)
 {
index 9202f28588949f09fe30c6edf2abe06fddc355d4..3ab7e67ee2e435a534bc0dde75b6f941a6f6604e 100644 (file)
@@ -981,7 +981,7 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)
                debug_sprintf_event(sfdbg, 6, "hw_perf_event_update: sdbt=%p "
                                    "overflow=%llu timestamp=0x%llx\n",
                                    sdbt, te->overflow,
-                                   (te->f) ? te->timestamp : 0ULL);
+                                   (te->f) ? trailer_timestamp(te) : 0ULL);
 
                /* Collect all samples from a single sample-data-block and
                 * flag if an (perf) event overflow happened.  If so, the PMU