|
@@ -4,7 +4,7 @@
|
|
|
#include <string.h>
|
|
|
#include <tiffio.h>
|
|
|
#include <unistd.h>
|
|
|
-#include "timer.h"
|
|
|
+#include <glib.h>
|
|
|
|
|
|
typedef struct {
|
|
|
unsigned width;
|
|
@@ -70,18 +70,18 @@ write_single_tiffs (uint16_t *data, ImageSize *size)
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
-print_time (const char *fmt, ImageSize *size, Timer *timer)
|
|
|
+print_time (const char *fmt, ImageSize *size, GTimer *timer)
|
|
|
{
|
|
|
size_t total;
|
|
|
|
|
|
total = size->width * size->height * size->num * 2;
|
|
|
- printf (fmt, ((double) total) / 1024. / 1024. / timer_get_seconds (timer));
|
|
|
+ printf (fmt, ((double) total) / 1024. / 1024. / g_timer_elapsed (timer, NULL));
|
|
|
}
|
|
|
|
|
|
int
|
|
|
main(int argc, char const* argv[])
|
|
|
{
|
|
|
- Timer *timer;
|
|
|
+ GTimer *timer;
|
|
|
|
|
|
ImageSize size = {
|
|
|
.width = 2048,
|
|
@@ -93,19 +93,19 @@ main(int argc, char const* argv[])
|
|
|
uint16_t *data;
|
|
|
|
|
|
data = malloc (size.width * size.height * 2);
|
|
|
- timer = timer_new ();
|
|
|
+ timer = g_timer_new ();
|
|
|
|
|
|
- timer_start (timer);
|
|
|
+ g_timer_start (timer);
|
|
|
write_multi_tiff (data, &size);
|
|
|
- timer_stop (timer);
|
|
|
+ g_timer_stop (timer);
|
|
|
print_time ("Multi TIFF: %f MB/s\n", &size, timer);
|
|
|
|
|
|
- timer_start (timer);
|
|
|
+ g_timer_start (timer);
|
|
|
write_single_tiffs (data, &size);
|
|
|
- timer_stop (timer);
|
|
|
+ g_timer_stop (timer);
|
|
|
print_time ("Single TIFF: %f MB/s\n", &size, timer);
|
|
|
|
|
|
- timer_destroy (timer);
|
|
|
+ g_timer_destroy (timer);
|
|
|
free (data);
|
|
|
return 0;
|
|
|
}
|