*
* So we have 53-30 = 23 bits left for tv_sec.
* */
+#ifdef EXTRA_CHECK
g_assert(t1.tv_sec <= MAX_TV_SEC_TO_DOUBLE);
if(t1.tv_sec > MAX_TV_SEC_TO_DOUBLE)
g_warning("Precision loss in conversion LttTime to double");
- return (double)t1.tv_sec + (double)t1.tv_nsec / NANOSECONDS_PER_SECOND;
+#endif //EXTRA_CHECK
+ return ((double)t1.tv_sec * NANOSECONDS_PER_SECOND) + (double)t1.tv_nsec;
}
*
* So we have 53-30 = 23 bits left for tv_sec.
* */
+#ifdef EXTRA_CHECK
g_assert(t1 <= MAX_TV_SEC_TO_DOUBLE);
if(t1 > MAX_TV_SEC_TO_DOUBLE)
g_warning("Conversion from non precise double to LttTime");
+#endif //EXTRA_CHECK
LttTime res;
- res.tv_sec = t1;
- res.tv_nsec = (t1 - res.tv_sec) * NANOSECONDS_PER_SECOND;
+ res.tv_sec = t1/(double)NANOSECONDS_PER_SECOND;
+ res.tv_nsec = (t1 - (res.tv_sec*NANOSECONDS_PER_SECOND));
return res;
}
{
/* We lose precision if tv_sec is > than (2^62)-1
* */
+#ifdef EXTRA_CHECK
g_assert(t1 <= MAX_TV_SEC_TO_UINT64);
if(t1 > MAX_TV_SEC_TO_UINT64)
g_warning("Conversion from non precise uint64 to LttTime");
+#endif //EXTRA_CHECK
LttTime res;
res.tv_sec = t1/NANOSECONDS_PER_SECOND;
res.tv_nsec = (t1 - res.tv_sec*NANOSECONDS_PER_SECOND);
}
-GtkWidget *guicontrolflow_get_widget(ControlFlowData *control_flow_data)
+__inline GtkWidget *guicontrolflow_get_widget(
+ ControlFlowData *control_flow_data)
{
return control_flow_data->top_widget ;
}
guicontrolflow_destructor_full(ControlFlowData *control_flow_data);
void
guicontrolflow_destructor(ControlFlowData *control_flow_data);
-GtkWidget *guicontrolflow_get_widget(ControlFlowData *control_flow_data);
-__inline ProcessList *guicontrolflow_get_process_list(ControlFlowData *control_flow_data);
+__inline GtkWidget *guicontrolflow_get_widget(
+ ControlFlowData *control_flow_data);
+__inline ProcessList *guicontrolflow_get_process_list(
+ ControlFlowData *control_flow_data);
#endif // _CFV_H
LttTime *time)
{
LttTime window_time_interval;
- guint64 time_ll;
+ double time_d;
window_time_interval = ltt_time_sub(window_time_end,
window_time_begin);
- time_ll = ltt_time_to_uint64(window_time_interval);
- time_ll = time_ll * x / width;
- *time = ltt_time_from_uint64(time_ll);
+ time_d = ltt_time_to_double(window_time_interval);
+ time_d = time_d / (double)width * (double)x;
+ *time = ltt_time_from_double(time_d);
*time = ltt_time_add(window_time_begin, *time);
}
guint *x)
{
LttTime window_time_interval;
- guint64 time_ll, interval_ll;
-
+ double time_d, interval_d;
+#ifdef EXTRA_CHECK
g_assert(ltt_time_compare(window_time_begin, time) <= 0 &&
ltt_time_compare(window_time_end, time) >= 0);
-
+#endif //EXTRA_CHECK
window_time_interval = ltt_time_sub(window_time_end,window_time_begin);
time = ltt_time_sub(time, window_time_begin);
- time_ll = ltt_time_to_uint64(time);
- interval_ll = ltt_time_to_uint64(window_time_interval);
+ time_d = ltt_time_to_double(time);
+ interval_d = ltt_time_to_double(window_time_interval);
- if(interval_ll == 0) {
- g_assert(time_ll == 0);
+ if(interval_d == 0.0) {
+ g_assert(time_d == 0.0);
*x = 0;
} else {
- *x = (guint)(time_ll * width / interval_ll);
+ *x = (guint)(time_d / interval_d * (double)width);
}
}
end = ltt_time_sub(time_span.end_time, time_span.start_time);
event_viewer_data->vadjust_c->upper =
- ltt_time_to_double(end) * NANOSECONDS_PER_SECOND;
+ ltt_time_to_double(end);
event_viewer_data->append = TRUE;
remove_all_items_from_queue(event_viewer_data->event_fields_queue);
end.tv_sec = G_MAXULONG;
end.tv_nsec = G_MAXULONG;
- time = ltt_time_from_double(time_value / NANOSECONDS_PER_SECOND);
+ time = ltt_time_from_double(time_value);
start = ltt_time_add(time_span.start_time, time);
event_viewer_data->previous_value = time_value;
get_events(event_viewer_data, start, end, RESERVE_SMALL_SIZE,&size);
event_fields = (EventFields*)g_list_nth_data(first,event_number);
if(!event_fields) event_fields = (EventFields*)g_list_nth_data(first,0);
time = ltt_time_sub(event_fields->time, time_span.start_time);
- event_viewer_data->vadjust_c->value = ltt_time_to_double(time) * NANOSECONDS_PER_SECOND;
+ event_viewer_data->vadjust_c->value = ltt_time_to_double(time);
//gtk_adjustment_set_value(event_viewer_data->vadjust_c,
- // ltt_time_to_double(time) * NANOSECONDS_PER_SECOND);
+ // ltt_time_to_double(time));
//g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->vadjust_c), "value-changed");
event_viewer_data->previous_value = event_viewer_data->vadjust_c->value;
//gtk_adjustment_value_changed(event_viewer_data->vadjust_c);
count = 0;
}
t = ltt_time_sub(data->time, time_span.start_time);
- event_viewer_data->vadjust_c->value = ltt_time_to_double(t) * NANOSECONDS_PER_SECOND;
+ event_viewer_data->vadjust_c->value = ltt_time_to_double(t);
//gtk_adjustment_set_value(event_viewer_data->vadjust_c,
- // ltt_time_to_double(t) * NANOSECONDS_PER_SECOND);
+ // ltt_time_to_double(t));
//g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->vadjust_c), "value-changed");
event_viewer_data->previous_value = event_viewer_data->vadjust_c->value;
insert_data_into_model(event_viewer_data,j, j+event_viewer_data->num_visible_events);
}else{//the event is not in the buffer
LttTime start = ltt_time_sub(*current_time, time_span.start_time);
- double position = ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
+ double position = ltt_time_to_double(start);
gtk_adjustment_set_value(event_viewer_data->vadjust_c, position);
}
}
event_viewer_data->append = TRUE;
end = ltt_time_sub(time_span.end_time, time_span.start_time);
- event_viewer_data->vadjust_c->upper = ltt_time_to_double(end) * NANOSECONDS_PER_SECOND;
+ event_viewer_data->vadjust_c->upper = ltt_time_to_double(end);
g_signal_emit_by_name(event_viewer_data->vadjust_c, "value-changed");
// event_viewer_data->vadjust_c->value = 0;
"lower",
0.0, /* lower */
"upper",
- ltt_time_to_double(upper)
- * NANOSECONDS_PER_SECOND, /* upper */
+ ltt_time_to_double(upper), /* upper */
"step_increment",
ltt_time_to_double(new_time_window.time_width)
- / SCROLL_STEP_PER_PAGE
- * NANOSECONDS_PER_SECOND, /* step increment */
+ / SCROLL_STEP_PER_PAGE, /* step increment */
"page_increment",
- ltt_time_to_double(new_time_window.time_width)
- * NANOSECONDS_PER_SECOND, /* page increment */
+ ltt_time_to_double(new_time_window.time_width),
+ /* page increment */
"page_size",
- ltt_time_to_double(new_time_window.time_width)
- * NANOSECONDS_PER_SECOND, /* page size */
+ ltt_time_to_double(new_time_window.time_width), /* page size */
NULL);
gtk_adjustment_changed(adjustment);
// "value",
// ltt_time_to_double(
// ltt_time_sub(start_time, time_span.start_time))
- // * NANOSECONDS_PER_SECOND, /* value */
+ // , /* value */
// NULL);
//gtk_adjustment_value_changed(adjustment);
gtk_range_set_value(GTK_RANGE(tab->scrollbar),
ltt_time_to_double(
- ltt_time_sub(start_time, time_span.start_time))
- * NANOSECONDS_PER_SECOND /* value */);
+ ltt_time_sub(start_time, time_span.start_time)) /* value */);
/* set the time bar. */
/* start seconds */
LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
TimeInterval time_span = tsc->time_span;
- time = ltt_time_add(ltt_time_from_double(value/NANOSECONDS_PER_SECOND),
+ time = ltt_time_add(ltt_time_from_double(value),
time_span.start_time);
new_time_window.start_time = time;
page_size = adjust->page_size;
new_time_window.time_width =
- ltt_time_from_double(page_size/NANOSECONDS_PER_SECOND);
+ ltt_time_from_double(page_size);
time_change_manager(tab, new_time_window);
//time = ltt_time_sub(time_span->end_time, time_span->start_time);
//time = ltt_time_mul(time, (float)ratio);
//time = ltt_time_add(time_span->start_time, time);
- time = ltt_time_add(ltt_time_from_double(value/NANOSECONDS_PER_SECOND),
+ time = ltt_time_add(ltt_time_from_double(value),
time_span.start_time);
time_window.start_time = time;
page_size = adjust->page_size;
time_window.time_width =
- ltt_time_from_double(page_size/NANOSECONDS_PER_SECOND);
+ ltt_time_from_double(page_size);
//time = ltt_time_sub(time_span.end_time, time);
//if(ltt_time_compare(time,time_window.time_width) < 0){
// time_window.time_width = time;
"upper",
ltt_time_to_double(
ltt_time_sub(time_span.end_time, time_span.start_time))
- * NANOSECONDS_PER_SECOND, /* upper */
+ , /* upper */
"step_increment",
ltt_time_to_double(time_window->time_width)
/ SCROLL_STEP_PER_PAGE
- * NANOSECONDS_PER_SECOND, /* step increment */
+ , /* step increment */
"page_increment",
ltt_time_to_double(time_window->time_width)
- * NANOSECONDS_PER_SECOND, /* page increment */
+ , /* page increment */
"page_size",
ltt_time_to_double(time_window->time_width)
- * NANOSECONDS_PER_SECOND, /* page size */
+ , /* page size */
NULL);
gtk_adjustment_changed(adjustment);
//g_object_set(G_OBJECT(adjustment),
// "value",
// ltt_time_to_double(time_window->start_time)
- // * NANOSECONDS_PER_SECOND, /* value */
+ // , /* value */
// NULL);
/* Note : the set value will call set_time_window if scrollbar value changed
*/
ltt_time_to_double(
ltt_time_sub(time_window->start_time,
time_span.start_time))
- * NANOSECONDS_PER_SECOND);
+ );
#endif //0
}