void TimelineViewWindow::set_time_scale (double ratio) { int64_t max = MaxScale; int64_t min = 1; if(ratio <= 0.0) { set_time_scale((int64_t)min); return; } if (ratio > 1.0) { ratio = 1.0; } set_time_scale((int64_t)(ratio * max)); }
/** * Function called when a keyboard key is pressed */ static void keyboard_down_func(unsigned char key, int x, int y){ key_down(key); switch(key){ case 'x': set_time_scale(0); break; case 'p': set_time_scale(1.0); break; case 'n': set_time_scale(get_time_scale()*1.10); break; case 'm': set_time_scale(get_time_scale()*0.9); break; default: break; } return; }
static int64_t raw_trc_val(struct domain *d) { uint64_t tsc; struct time_scale tsc_to_ns; tsc = hvm_get_guest_tsc(pt_global_vcpu_target(d)); /* convert tsc to count of 100ns periods */ set_time_scale(&tsc_to_ns, d->arch.tsc_khz * 1000ul); return scale_delta(tsc, &tsc_to_ns) / 100ul; }
void TimelineViewWindow::zoom_view(int point, double time_scale_ratio) { // Apply the smoothing factor int64_t new_time_scale(pow (time_scale_ratio, ZoomSmoothing) * double(MaxScale)); /* Prevent Zooming in To Close and Far */ if(new_time_scale < 1) new_time_scale = 1; if(new_time_scale > MaxScale) new_time_scale = MaxScale; // The view must be shifted so that the zoom is centred on the cursor TimeVar newStartPoint = timeOffset + TimeValue(point * (timeScale - new_time_scale)); set_time_offset (newStartPoint); // Apply the new scale set_time_scale(new_time_scale); }