[gtk/tracing] Don't build profiler on win32



commit 0c64b3406b339e67744f61059db2b0464ba674a7
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon May 6 14:51:55 2019 -0700

    Don't build profiler on win32
    
    It doesn't currently work there.

 gdk/gdkprofiler.c    | 123 +++++++++++++++++++++++++++++++++++++--------------
 gdk/meson.build      |  11 +++--
 gtk/gtkapplication.c |  27 ++++++++++-
 3 files changed, 124 insertions(+), 37 deletions(-)
---
diff --git a/gdk/gdkprofiler.c b/gdk/gdkprofiler.c
index eab63836cb..dc6fd3cd9c 100644
--- a/gdk/gdkprofiler.c
+++ b/gdk/gdkprofiler.c
@@ -24,11 +24,14 @@
 #include <unistd.h>
 
 #include "gdkversionmacros.h"
-#include "capture/sp-capture-writer.h"
 #include "gdkprofiler.h"
 #include "gdkprofilerprivate.h"
 #include "gdkframeclockprivate.h"
 
+#ifndef G_OS_WIN32
+
+#include "capture/sp-capture-writer.h"
+
 static SpCaptureWriter *writer = NULL;
 static gboolean running = FALSE;
 
@@ -92,37 +95,6 @@ gdk_profiler_add_mark (gint64      start,
                               "gtk", name, message);
 }
 
-/**
- * gdk_profiler_set_mark:
- * @duration: the duration of the mark, or 0
- * @name: the name of the mark (up to 40 characters)
- * @message: (optional): the message of the mark
- *
- * Insert a mark into the profiling data if we
- * are currently profiling.
- * This information will show up in tools like sysprof
- * or GNOME Builder when viewing the profiling data.
- * It can be used to mark interesting regions in the
- * captured data.
- *
- * If the duration is non-zero, the mark applies to
- * the timespan from @duration microseconds in the
- * past to the current time. To mark just a point in
- * time, pass 0 as duration.
- *
- * @name should be a short string, and @message is optional.
- */
-void
-gdk_profiler_set_mark (guint64     duration,
-                       const char *name,
-                       const char *message)
-{
-  guint64 start;
-
-  start = g_get_monotonic_time () - duration;
-  gdk_profiler_add_mark (start, duration, name, message);
-}
-
 static guint
 define_counter (const char *name,
                 const char *description,
@@ -197,3 +169,90 @@ gdk_profiler_set_int_counter (guint  id,
                                   -1, getpid (),
                                   &id, &value, 1);
 }
+
+#else
+
+void
+gdk_profiler_start (int fd)
+{
+}
+
+void
+gdk_profiler_stop (void)
+{
+}
+
+gboolean
+gdk_profiler_is_running (void)
+{
+  return FALSE;
+}
+
+void
+gdk_profiler_add_mark (gint64      start,
+                       guint64     duration,
+                       const char *name,
+                       const char *message)
+{
+}
+
+guint
+gdk_profiler_define_counter (const char *name,
+                             const char *description)
+{
+ return 0;
+}
+
+void
+gdk_profiler_set_counter (guint  id,
+                          gint64 time,
+                          double value)
+{
+}
+
+guint
+gdk_profiler_define_int_counter (const char *name,
+                                 const char *description)
+{
+  return 0;
+}
+
+void
+gdk_profiler_set_int_counter (guint  id,
+                              gint64 time,
+                              gint64 value)
+{
+}
+
+#endif /* G_OS_WIN32 */
+
+/**
+ * gdk_profiler_set_mark:
+ * @duration: the duration of the mark, or 0
+ * @name: the name of the mark (up to 40 characters)
+ * @message: (optional): the message of the mark
+ *
+ * Insert a mark into the profiling data if we
+ * are currently profiling.
+ * This information will show up in tools like sysprof
+ * or GNOME Builder when viewing the profiling data.
+ * It can be used to mark interesting regions in the
+ * captured data.
+ *
+ * If the duration is non-zero, the mark applies to
+ * the timespan from @duration microseconds in the
+ * past to the current time. To mark just a point in
+ * time, pass 0 as duration.
+ *
+ * @name should be a short string, and @message is optional.
+ */
+void
+gdk_profiler_set_mark (guint64     duration,
+                       const char *name,
+                       const char *message)
+{
+  guint64 start;
+
+  start = g_get_monotonic_time () - duration;
+  gdk_profiler_add_mark (start, duration, name, message);
+}
diff --git a/gdk/meson.build b/gdk/meson.build
index 5be5118121..3c411c1fb9 100644
--- a/gdk/meson.build
+++ b/gdk/meson.build
@@ -45,11 +45,16 @@ gdk_public_sources = files([
   'gdkvulkancontext.c',
   'gdksurface.c',
   'gdksurfaceimpl.c',
-  'gdkprofiler.c',
-  'capture/sp-capture-writer.c',
-  'capture/sp-clock.c'
+  'gdkprofiler.c'
 ])
 
+if not win32_enabled
+  gdk_public_sources += files([
+    'capture/sp-capture-writer.c',
+    'capture/sp-clock.c'
+  ])
+endif
+
 gdk_public_headers = files([
   'gdk-autocleanup.h',
   'gdk.h',
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index d5f3c1a384..944d7fc8d9 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -22,8 +22,10 @@
 
 #include "gtkapplication.h"
 #include "gdkprofilerprivate.h"
-#include <gio/gunixfdlist.h>
 
+#ifdef G_OS_UNIX
+#include <gio/gunixfdlist.h>
+#endif
 
 #include <stdlib.h>
 
@@ -606,6 +608,8 @@ gtk_application_finalize (GObject *object)
   G_OBJECT_CLASS (gtk_application_parent_class)->finalize (object);
 }
 
+#ifdef G_OS_UNIX
+
 static const gchar org_gnome_Sysprof2_Profiler_xml[] =
   "<node>"
     "<interface name='org.gnome.Sysprof2.Profiler'>"
@@ -679,7 +683,6 @@ sysprof_profiler_method_call (GDBusConnection       *connection,
   g_dbus_method_invocation_return_value (invocation, NULL);
 }
 
-
 static gboolean
 gtk_application_dbus_register (GApplication     *application,
                                GDBusConnection  *connection,
@@ -727,6 +730,26 @@ gtk_application_dbus_unregister (GApplication     *application,
   g_dbus_connection_unregister_object (connection, dbus->profiler_id);
 }
 
+#else
+
+static gboolean
+gtk_application_dbus_register (GApplication     *application,
+                               GDBusConnection  *connection,
+                               const char       *obect_path,
+                               GError          **error)
+{
+  return TRUE;
+}
+
+static void
+gtk_application_dbus_unregister (GApplication     *application,
+                                 GDBusConnection  *connection,
+                                 const char       *obect_path)
+{
+}
+
+#endif
+
 static void
 gtk_application_class_init (GtkApplicationClass *class)
 {


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