timestamp_t *timestamp_ptr = ts;
timestamp_t *timestamp_buff_end = &ts[TS_SIZE];
bool timestamp_enabled = true;
+bool timestamp_finished = false;
static int cnt=0;
struct timespec meas_start_ts;
FILE *file;
static pid_t pid=-1;
+uint64_t boot_tb;
void timing_statistics_asm(void);
void timing_output_trace_screen(void);
uint64_t mulhdu(uint64_t a, uint64_t b)
{
uint64_t ret, ah, al, bh, bl, carry, c1, c2, c3;
+
ah = a>>32;
al = a & 0xffffffff;
bh = b>>32;
bl = b & 0xffffffff;
-
+
c1 = al*bl;
c2 = (ah*bl)<<32;
c3 = (al*bh)<<32;
-
+
carry = 0;
if (~c1 < c2) carry++;
c1 += c2;
if (~c1 < c3) carry++;
-
ret = ah*bh + (ah*bl>>32) + (al*bh>>32) + carry;
return ret;
unsigned long int sec, usec;
tb = restore_tb(ts->tbu, ts->tbl);
- ns = (uint64_t)((mulhdu(tb - get_boot_tb(), tb_to_ns_scale))<<5);
+
+ ns = mulhdu(tb - boot_tb, tb_to_ns_scale) << 5;
sched_clock = ns2usec(ns);
-
+
usec = do_div(&sched_clock, 1000000ULL);
sec = (uint32_t) (sched_clock);
printf("%d %5lu.%06lu\n", ts->id, sec, usec);
#endif
#ifdef CONFIG_TIMING_OUTPUT_FILE
+ printf("%5lu.%06lu\t%d\t%d\tR\t%llu\n", sec, usec, pid, ts->id, tb);
fprintf(file, "%5lu.%06lu\t%d\t%d\tR\t%llu\n", sec, usec, pid, ts->id, tb);
#endif
}
return 0;
}
-void timing_ipoint_dummy(unsigned char id)
+void timing_ipoint_dummy(uint16_t id)
{
printf("timing: Instrumentation point type not set!\n");
}
+void timing_ipoint_finished(uint16_t id)
+{
+ printf("timing: Instrumentation point called after timing finish!\n");
+}
+
#ifdef CONFIG_TIMING_IPOINT_ASM
-void timing_ipoint_asm(unsigned char id)
+void timing_ipoint_asm(uint16_t id)
{
timestamp_t *p, *pinc;
uint32_t tbu, tb, tbu2;
+ if(!timestamp_finished) {
/* Store current TB */
asm volatile (
"1:\n"
p->id = id;
p->tbu = tbu;
p->tbl = tb;
+ }
}
#endif
#ifdef CONFIG_TIMING_IPOINT_CLOCK_GETTIME
-void timing_ipoint_clock_gettime(unsigned char id)
+void timing_ipoint_clock_gettime(uint16_t id)
{
timestamp_t *p, *pinc;
#ifdef CONFIG_TIMING_IPOINT_ASM
timing_ipoint = timing_ipoint_asm;
timing_statistics = timing_statistics_asm;
+ boot_tb = get_boot_tb();
#endif
#ifdef CONFIG_TIMING_IPOINT_CLOCK_GETTIME
timing_ipoint = timing_ipoint_clock_gettime;
void timing_finish()
{
+ timing_ipoint = timing_ipoint_finished;
system("echo 0 > /debug/tracing/tracing_enabled");
#ifdef CONFIG_TIMING_OUTPUT_FILE
system("cat /debug/tracing/trace > taskswitch.log");