summaryrefslogtreecommitdiff
path: root/base/gxsync.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-05-02 19:31:27 +0100
committerRobin Watts <robin.watts@artifex.com>2016-06-14 18:30:13 +0100
commit3bc51652cc962f0256acdf37f52d0a7d98b20ed1 (patch)
treef9329b8c866d23f58212008e464f545765387023 /base/gxsync.c
parentb3cea386ef8ebc24198963a26c90ad33dc1f8f07 (diff)
downloadghostpdl-3bc51652cc962f0256acdf37f52d0a7d98b20ed1.tar.gz
Bobbin: Add first version of Bobbin.
A simple tool to help debug performance problems with threads. Build with BOBBIN defined, and all pthreads calls (or at least all the ones gs uses) go through Bobbin. This keeps track of the time each threads spends waiting on mutexes or condition variables. Hopefully this allows contention to be spotted. A report is printed at the end.
Diffstat (limited to 'base/gxsync.c')
-rw-r--r--base/gxsync.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/base/gxsync.c b/base/gxsync.c
index fed51e9b4..a1326346a 100644
--- a/base/gxsync.c
+++ b/base/gxsync.c
@@ -76,6 +76,14 @@ gx_semaphore_free(
}
}
+gx_semaphore_t *(gx_semaphore_label)(gx_semaphore_t *sema, const char *name)
+{
+ (void)name;
+ if (sema)
+ gp_semaphore_label(&sema->native, name);
+ return sema;
+}
+
/* Macros defined in gxsync.h, but redefined here so compiler chex consistency */
#define gx_semaphore_wait(sema) gp_semaphore_wait(&(sema)->native)
#define gx_semaphore_signal(sema) gp_semaphore_signal(&(sema)->native)
@@ -129,6 +137,15 @@ gx_monitor_free(
}
}
+gx_monitor_t *
+(gx_monitor_label)(gx_monitor_t *mon, const char *name)
+{
+ (void)name;
+ if (mon)
+ gp_monitor_label(&mon->native, name);
+ return mon;
+}
+
/* Macros defined in gxsync.h, but redefined here so compiler chex consistency */
#define gx_monitor_enter(sema) gp_monitor_enter(&(sema)->native)
#define gx_monitor_leave(sema) gp_monitor_leave(&(sema)->native)