[sysprof] capture: use gint32 instead of GPid



commit 607ef387e77040ec4d134bbf3bb92ec348bcf8d9
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 6 20:03:33 2019 -0700

    capture: use gint32 instead of GPid
    
    GPid just isn't portable as a data type for on-disk storage, so
    be more explicit and use gint32 directly.

 lib/capture/sp-capture-condition.c | 12 ++++++------
 lib/capture/sp-capture-condition.h |  2 +-
 lib/capture/sp-capture-writer.c    | 24 ++++++++++++------------
 lib/capture/sp-capture-writer.h    | 20 ++++++++++----------
 4 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/lib/capture/sp-capture-condition.c b/lib/capture/sp-capture-condition.c
index 72ce834..07ab6fb 100644
--- a/lib/capture/sp-capture-condition.c
+++ b/lib/capture/sp-capture-condition.c
@@ -88,7 +88,7 @@ sp_capture_condition_match (const SpCaptureCondition *self,
     case SP_CAPTURE_CONDITION_WHERE_PID_IN:
       for (guint i = 0; i < self->u.where_pid_in->len; i++)
         {
-          if (frame->pid == g_array_index (self->u.where_pid_in, GPid, i))
+          if (frame->pid == g_array_index (self->u.where_pid_in, gint32, i))
             return TRUE;
         }
       return FALSE;
@@ -169,7 +169,7 @@ sp_capture_condition_copy (const SpCaptureCondition *self)
     case SP_CAPTURE_CONDITION_WHERE_PID_IN:
       return sp_capture_condition_new_where_pid_in (
           self->u.where_pid_in->len,
-          (const GPid *)(gpointer)self->u.where_pid_in->data);
+          (const gint32 *)(gpointer)self->u.where_pid_in->data);
 
     case SP_CAPTURE_CONDITION_WHERE_COUNTER_IN:
       return sp_capture_condition_new_where_counter_in (
@@ -261,8 +261,8 @@ sp_capture_condition_new_where_time_between (gint64 begin_time,
 }
 
 SpCaptureCondition *
-sp_capture_condition_new_where_pid_in (guint       n_pids,
-                                       const GPid *pids)
+sp_capture_condition_new_where_pid_in (guint         n_pids,
+                                       const gint32 *pids)
 {
   SpCaptureCondition *self;
 
@@ -270,9 +270,9 @@ sp_capture_condition_new_where_pid_in (guint       n_pids,
 
   self = g_slice_new0 (SpCaptureCondition);
   self->type = SP_CAPTURE_CONDITION_WHERE_PID_IN;
-  self->u.where_pid_in = g_array_sized_new (FALSE, FALSE, sizeof (GPid), n_pids);
+  self->u.where_pid_in = g_array_sized_new (FALSE, FALSE, sizeof (gint32), n_pids);
   g_array_set_size (self->u.where_pid_in, n_pids);
-  memcpy (self->u.where_pid_in->data, pids, sizeof (GPid) * n_pids);
+  memcpy (self->u.where_pid_in->data, pids, sizeof (gint32) * n_pids);
 
   return self;
 }
diff --git a/lib/capture/sp-capture-condition.h b/lib/capture/sp-capture-condition.h
index e0c5dda..659291b 100644
--- a/lib/capture/sp-capture-condition.h
+++ b/lib/capture/sp-capture-condition.h
@@ -35,7 +35,7 @@ SpCaptureCondition *sp_capture_condition_new_where_type_in      (guint
 SpCaptureCondition *sp_capture_condition_new_where_time_between (gint64                    begin_time,
                                                                  gint64                    end_time);
 SpCaptureCondition *sp_capture_condition_new_where_pid_in       (guint                     n_pids,
-                                                                 const GPid               *pids);
+                                                                 const gint32             *pids);
 SpCaptureCondition *sp_capture_condition_new_where_counter_in   (guint                     n_counters,
                                                                  const guint              *counters);
 gboolean            sp_capture_condition_match                  (const SpCaptureCondition *self,
diff --git a/lib/capture/sp-capture-writer.c b/lib/capture/sp-capture-writer.c
index 2525063..64dc1c6 100644
--- a/lib/capture/sp-capture-writer.c
+++ b/lib/capture/sp-capture-writer.c
@@ -106,7 +106,7 @@ static inline void
 sp_capture_writer_frame_init (SpCaptureFrame     *frame_,
                               gint                len,
                               gint                cpu,
-                              GPid                pid,
+                              gint32              pid,
                               gint64              time_,
                               SpCaptureFrameType  type)
 {
@@ -256,7 +256,7 @@ sp_capture_writer_flush_jitmap (SpCaptureWriter *self)
   sp_capture_writer_frame_init (&jitmap.frame,
                                 len,
                                 -1,
-                                getpid (),
+                                _sp_getpid (),
                                 SP_CAPTURE_CURRENT_TIME,
                                 SP_CAPTURE_FRAME_JITMAP);
   jitmap.n_jitmaps = self->addr_hash_size;
@@ -497,7 +497,7 @@ gboolean
 sp_capture_writer_add_map (SpCaptureWriter *self,
                            gint64           time,
                            gint             cpu,
-                           GPid             pid,
+                           gint32           pid,
                            guint64          start,
                            guint64          end,
                            guint64          offset,
@@ -542,7 +542,7 @@ gboolean
 sp_capture_writer_add_mark (SpCaptureWriter *self,
                             gint64           time,
                             gint             cpu,
-                            GPid             pid,
+                            gint32           pid,
                             guint64          duration,
                             const gchar     *group,
                             const gchar     *name,
@@ -604,7 +604,7 @@ gboolean
 sp_capture_writer_add_process (SpCaptureWriter *self,
                                gint64           time,
                                gint             cpu,
-                               GPid             pid,
+                               gint32           pid,
                                const gchar     *cmdline)
 {
   SpCaptureProcess *ev;
@@ -641,7 +641,7 @@ gboolean
 sp_capture_writer_add_sample (SpCaptureWriter        *self,
                               gint64                  time,
                               gint                    cpu,
-                              GPid                    pid,
+                              gint32                  pid,
                               const SpCaptureAddress *addrs,
                               guint                   n_addrs)
 {
@@ -675,8 +675,8 @@ gboolean
 sp_capture_writer_add_fork (SpCaptureWriter *self,
                             gint64           time,
                             gint             cpu,
-                            GPid             pid,
-                            GPid             child_pid)
+                            gint32           pid,
+                            gint32           child_pid)
 {
   SpCaptureFork *ev;
   gsize len = sizeof *ev;
@@ -704,7 +704,7 @@ gboolean
 sp_capture_writer_add_exit (SpCaptureWriter *self,
                             gint64           time,
                             gint             cpu,
-                            GPid             pid)
+                            gint32           pid)
 {
   SpCaptureExit *ev;
   gsize len = sizeof *ev;
@@ -731,7 +731,7 @@ gboolean
 sp_capture_writer_add_timestamp (SpCaptureWriter *self,
                                  gint64           time,
                                  gint             cpu,
-                                 GPid             pid)
+                                 gint32           pid)
 {
   SpCaptureTimestamp *ev;
   gsize len = sizeof *ev;
@@ -1051,7 +1051,7 @@ gboolean
 sp_capture_writer_define_counters (SpCaptureWriter        *self,
                                    gint64                  time,
                                    gint                    cpu,
-                                   GPid                    pid,
+                                   gint32                  pid,
                                    const SpCaptureCounter *counters,
                                    guint                   n_counters)
 {
@@ -1101,7 +1101,7 @@ gboolean
 sp_capture_writer_set_counters (SpCaptureWriter             *self,
                                 gint64                       time,
                                 gint                         cpu,
-                                GPid                         pid,
+                                gint32                       pid,
                                 const guint                 *counters_ids,
                                 const SpCaptureCounterValue *values,
                                 guint                        n_counters)
diff --git a/lib/capture/sp-capture-writer.h b/lib/capture/sp-capture-writer.h
index ed94960..3b817e5 100644
--- a/lib/capture/sp-capture-writer.h
+++ b/lib/capture/sp-capture-writer.h
@@ -49,7 +49,7 @@ void                sp_capture_writer_stat            (SpCaptureWriter         *
 gboolean            sp_capture_writer_add_map         (SpCaptureWriter         *self,
                                                        gint64                   time,
                                                        gint                     cpu,
-                                                       GPid                     pid,
+                                                       gint32                   pid,
                                                        guint64                  start,
                                                        guint64                  end,
                                                        guint64                  offset,
@@ -58,7 +58,7 @@ gboolean            sp_capture_writer_add_map         (SpCaptureWriter         *
 gboolean            sp_capture_writer_add_mark        (SpCaptureWriter         *self,
                                                        gint64                   time,
                                                        gint                     cpu,
-                                                       GPid                     pid,
+                                                       gint32                   pid,
                                                        guint64                  duration,
                                                        const gchar             *group,
                                                        const gchar             *name,
@@ -68,37 +68,37 @@ guint64             sp_capture_writer_add_jitmap      (SpCaptureWriter         *
 gboolean            sp_capture_writer_add_process     (SpCaptureWriter         *self,
                                                        gint64                   time,
                                                        gint                     cpu,
-                                                       GPid                     pid,
+                                                       gint32                   pid,
                                                        const gchar             *cmdline);
 gboolean            sp_capture_writer_add_sample      (SpCaptureWriter         *self,
                                                        gint64                   time,
                                                        gint                     cpu,
-                                                       GPid                     pid,
+                                                       gint32                   pid,
                                                        const SpCaptureAddress  *addrs,
                                                        guint                    n_addrs);
 gboolean            sp_capture_writer_add_fork        (SpCaptureWriter         *self,
                                                        gint64                   time,
                                                        gint                     cpu,
-                                                       GPid                     pid,
-                                                       GPid                     child_pid);
+                                                       gint32                   pid,
+                                                       gint32                   child_pid);
 gboolean            sp_capture_writer_add_exit        (SpCaptureWriter         *self,
                                                        gint64                   time,
                                                        gint                     cpu,
-                                                       GPid                     pid);
+                                                       gint32                   pid);
 gboolean            sp_capture_writer_add_timestamp   (SpCaptureWriter         *self,
                                                        gint64                   time,
                                                        gint                     cpu,
-                                                       GPid                     pid);
+                                                       gint32                   pid);
 gboolean            sp_capture_writer_define_counters (SpCaptureWriter         *self,
                                                        gint64                   time,
                                                        gint                     cpu,
-                                                       GPid                     pid,
+                                                       gint32                   pid,
                                                        const SpCaptureCounter  *counters,
                                                        guint                    n_counters);
 gboolean            sp_capture_writer_set_counters    (SpCaptureWriter         *self,
                                                        gint64                   time,
                                                        gint                     cpu,
-                                                       GPid                     pid,
+                                                       gint32                   pid,
                                                        const guint             *counters_ids,
                                                        const SpCaptureCounterValue *values,
                                                        guint                    n_counters);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]