[sysprof] visualizers: use double instead of float
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] visualizers: use double instead of float
- Date: Sun, 17 Jun 2018 03:24:18 +0000 (UTC)
commit 50ccd73592e2e6c73826e9d1929846b180910249
Author: Christian Hergert <chergert redhat com>
Date: Sat Jun 16 20:22:53 2018 -0700
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).
lib/util/pointcache.c | 4 ++--
lib/util/pointcache.h | 8 ++++----
lib/visualizers/sp-line-visualizer-row.c | 14 +++++++-------
lib/visualizers/sp-visualizer-row.h | 4 ++--
4 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/lib/util/pointcache.c b/lib/util/pointcache.c
index 6530e46..ccdf140 100644
--- a/lib/util/pointcache.c
+++ b/lib/util/pointcache.c
@@ -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 };
diff --git a/lib/util/pointcache.h b/lib/util/pointcache.h
index 1058df7..5accceb 100644
--- a/lib/util/pointcache.h
+++ b/lib/util/pointcache.h
@@ -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);
diff --git a/lib/visualizers/sp-line-visualizer-row.c b/lib/visualizers/sp-line-visualizer-row.c
index e00594b..b69d884 100644
--- a/lib/visualizers/sp-line-visualizer-row.c
+++ b/lib/visualizers/sp-line-visualizer-row.c
@@ -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);
diff --git a/lib/visualizers/sp-visualizer-row.h b/lib/visualizers/sp-visualizer-row.h
index c7f6163..2f15d95 100644
--- a/lib/visualizers/sp-visualizer-row.h
+++ b/lib/visualizers/sp-visualizer-row.h
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]