mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
visualizers: use double instead of float
To give us less changes of incorrect values when converting between scales (at the cost of 2x the array size).
This commit is contained in:
@ -80,8 +80,8 @@ point_cache_contains_set (PointCache *self,
|
||||
void
|
||||
point_cache_add_point_to_set (PointCache *self,
|
||||
guint set_id,
|
||||
gfloat x,
|
||||
gfloat y)
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
GArray *ar;
|
||||
Point point = { x, y };
|
||||
|
||||
@ -27,8 +27,8 @@ typedef struct _PointCache PointCache;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
} Point;
|
||||
|
||||
PointCache *point_cache_new (void);
|
||||
@ -40,8 +40,8 @@ gboolean point_cache_contains_set (PointCache *self,
|
||||
guint set_id);
|
||||
void point_cache_add_point_to_set (PointCache *self,
|
||||
guint set_id,
|
||||
gfloat x,
|
||||
gfloat y);
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
const Point *point_cache_get_points (PointCache *self,
|
||||
guint set_id,
|
||||
guint *n_points);
|
||||
|
||||
@ -170,8 +170,8 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
|
||||
|
||||
if (n_fpoints > 0)
|
||||
{
|
||||
gfloat last_x;
|
||||
gfloat last_y;
|
||||
gdouble last_x;
|
||||
gdouble last_y;
|
||||
|
||||
points = g_new0 (SpVisualizerRowAbsolutePoint, n_fpoints);
|
||||
|
||||
@ -534,7 +534,7 @@ counter_type (LoadData *load,
|
||||
return SP_CAPTURE_COUNTER_DOUBLE;
|
||||
}
|
||||
|
||||
static inline gfloat
|
||||
static inline gdouble
|
||||
calc_x (gint64 lower,
|
||||
gint64 upper,
|
||||
gint64 value)
|
||||
@ -542,7 +542,7 @@ calc_x (gint64 lower,
|
||||
return (gdouble)(value - lower) / (gdouble)(upper - lower);
|
||||
}
|
||||
|
||||
static inline gfloat
|
||||
static inline gdouble
|
||||
calc_y_double (gdouble lower,
|
||||
gdouble upper,
|
||||
gdouble value)
|
||||
@ -550,7 +550,7 @@ calc_y_double (gdouble lower,
|
||||
return (value - lower) / (upper - lower);
|
||||
}
|
||||
|
||||
static inline gfloat
|
||||
static inline gdouble
|
||||
calc_y_int64 (gint64 lower,
|
||||
gint64 upper,
|
||||
gint64 value)
|
||||
@ -572,7 +572,7 @@ sp_line_visualizer_row_load_data_frame_cb (const SpCaptureFrame *frame,
|
||||
if (frame->type == SP_CAPTURE_FRAME_CTRSET)
|
||||
{
|
||||
const SpCaptureFrameCounterSet *set = (SpCaptureFrameCounterSet *)frame;
|
||||
gfloat x = calc_x (load->begin_time, load->end_time, frame->time);
|
||||
gdouble x = calc_x (load->begin_time, load->end_time, frame->time);
|
||||
|
||||
for (guint i = 0; i < set->n_values; i++)
|
||||
{
|
||||
@ -584,7 +584,7 @@ sp_line_visualizer_row_load_data_frame_cb (const SpCaptureFrame *frame,
|
||||
|
||||
if (counter_id != 0 && contains_id (load->lines, counter_id))
|
||||
{
|
||||
gfloat y;
|
||||
gdouble y;
|
||||
|
||||
if (counter_type (load, counter_id) == SP_CAPTURE_COUNTER_DOUBLE)
|
||||
y = calc_y_double (load->y_lower, load->y_upper, group->values[j].vdbl);
|
||||
|
||||
@ -32,8 +32,8 @@ G_DECLARE_DERIVABLE_TYPE (SpVisualizerRow, sp_visualizer_row, SP, VISUALIZER_ROW
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
} SpVisualizerRowRelativePoint;
|
||||
|
||||
typedef struct
|
||||
|
||||
Reference in New Issue
Block a user