void timing_statistics_asm(void);
void timing_output_trace_screen(void);
void timing_output_trace_file(void);
+void timing_statistics_clock_gettime(void);
timestamp_t * timestamp_handle_overflow(void)
{
#endif
#ifdef CONFIG_TIMING_IPOINT_CLOCK_GETTIME
-void timing_ipoint_clock_gettime(unsigned short id)
+void timing_ipoint_clock_gettime(unsigned char id)
{
timestamp_t *p, *pinc;
if (!p)
return;
}
- else
+ else {
+ p->id = id;
timestamp_ptr++;
+ }
}
#endif
#endif
#ifdef CONFIG_TIMING_IPOINT_CLOCK_GETTIME
timing_ipoint = timing_ipoint_clock_gettime;
+ timing_statistics = timing_statistics_clock_gettime;
#endif
system("mount -t debugfs trace /debug");
system("echo sched_switch > /debug/tracing/current_tracer");
timing_output_trace = timing_output_trace_file;
#endif
printf("Timing library initialized!\n");
+ system("dmesg | grep tb_orig_stamp | sed 's#.*tb_orig_stamp\\=\\([0-9]*\\).*#\\1#' | tee tb_orig_stamp");
system("echo 1 > /debug/tracing/tracing_enabled");
clock_gettime(clk_id, &meas_start_ts);
}
system("echo nop > /debug/tracing/current_tracer");
}
+#ifdef CONFIG_TIMING_IPOINT_ASM
void print_ts_asm(timestamp_t *ts)
{
printf("%d %llu\n", ts->id, (uint64_t)((uint64_t)ts->tbu << 32 | ts->tbl));
}
+#endif
void timing_output_trace_screen(void)
{
if(timestamp_enabled)
while(ts_iter != (timestamp_ptr+1))
{
+#ifdef CONFIG_TIMING_IPOINT_ASM
print_ts_asm(ts_iter);
+#endif
ts_iter++;
i++;
}
printf("got %d timestamps over limit\n",cnt);
}
+double timespec2sec(struct timespec *tspec)
+{
+ double result;
+
+ result = tspec->tv_sec + (tspec->tv_nsec*0.000000001);
+
+ return result;
+}
+
void timing_output_trace_file(void)
{
FILE *file;
(uint64_t)((uint64_t)ts_iter->tbu << 32 | ts_iter->tbl));
#endif
#ifdef CONFIG_TIMING_IPOINT_CLOCK_GETTIME
+ fprintf(file, "%d %.6f\n", ts_iter->id, timespec2sec(&ts_iter->ts));
#endif
ts_iter++;
i++;
fclose(file);
}
+#ifdef CONFIG_TIMING_IPOINT_ASM
double sub_timestamps_us(timestamp_t *t1, timestamp_t *t2)
{
double result;
else
printf("got %d timestamps over limit\n",cnt);
}
+#endif
+
+double sub_ts_us(struct timespec start, struct timespec end)
+{
+ struct timespec temp;
+ double ret;
+
+ if ((end.tv_nsec-start.tv_nsec)<0) {
+ temp.tv_sec = end.tv_sec-start.tv_sec-1;
+ temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
+ } else {
+ temp.tv_sec = end.tv_sec-start.tv_sec;
+ temp.tv_nsec = end.tv_nsec-start.tv_nsec;
+ }
+
+ ret = (temp.tv_sec * 1000000.0) + (temp.tv_nsec/1000.0);
+
+ return ret;
+}
+
+#ifdef CONFIG_TIMING_IPOINT_CLOCK_GETTIME
+void timing_statistics_clock_gettime(void)
+{
+ timestamp_t *ts_iter;
+ int i=1;
+
+ printf("Highrest_Statistics\n");
+ ts_iter = ts;
+
+ if(timestamp_enabled)
+ while(ts_iter != (timestamp_ptr+1))
+ {
+ if(i%2 == 0) {
+ printf("%3.2f\n", sub_ts_us((ts_iter-1)->ts,(ts_iter)->ts));
+ }
+ ts_iter++;
+ i++;
+ }
+ else
+ printf("got %d timestamps over limit\n",cnt);
+}
+#endif