From patchwork Thu Jun 2 13:33:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mandeep Kumar X-Patchwork-Id: 1725 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:54:58 -0000 Delivered-To: patches@linaro.org Received: by 10.52.181.10 with SMTP id ds10cs370033vdc; Thu, 2 Jun 2011 06:33:37 -0700 (PDT) Received: by 10.42.21.131 with SMTP id k3mr1403288icb.237.1307021616252; Thu, 02 Jun 2011 06:33:36 -0700 (PDT) Received: from mail-pz0-f50.google.com (mail-pz0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id s13si1844065ibk.116.2011.06.02.06.33.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 02 Jun 2011 06:33:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of mandeep.kumar@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of mandeep.kumar@linaro.org) smtp.mail=mandeep.kumar@linaro.org Received: by pzk2 with SMTP id 2so448289pzk.37 for ; Thu, 02 Jun 2011 06:33:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.61.18 with SMTP id j18mr112177wfa.75.1307021613032; Thu, 02 Jun 2011 06:33:33 -0700 (PDT) Received: by 10.142.143.8 with HTTP; Thu, 2 Jun 2011 06:33:33 -0700 (PDT) Date: Thu, 2 Jun 2011 08:33:33 -0500 Message-ID: Subject: [PATCH] Added Benchmarking Hooks in djpeg Application. From: Mandeep Kumar To: Kurt Taylor , Rob Clark , Rony Nandy , Kan Hu , Feng Wei , Vishal Raj , Benjamin Gaignard , Sudip Jain Cc: Patch Tracking >From 1bd38dda5ac8a392ef067b9812e77f56817bafd1 Mon Sep 17 00:00:00 2001 From: Mandeep Kumar Date: Tue, 10 May 2011 15:17:42 -0500 Subject: [PATCH] Added Benchmarking Hooks in djpeg Application. --- configure | 2 +- configure.ac | 2 +- djpeg.c | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) mode change 100644 => 100755 configure.ac +#endif /* * This list defines the known output image formats @@ -588,6 +608,9 @@ main (int argc, char **argv) /* Write output file header */ (*dest_mgr->start_output) (&cinfo, dest_mgr); + TIMER_DEFINE_VARS; + TIMER_START; + /* Process data */ while (cinfo.output_scanline < cinfo.output_height) { num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, @@ -595,6 +618,9 @@ main (int argc, char **argv) (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines); } + TIMER_STOP; + TIMER_PRINT ("Decoding took %d ms\n", TIMER_GETDIFF_MS()); + #ifdef PROGRESS_REPORT /* Hack: count final pass as done in case finish_output does an extra pass. * The library won't have updated completed_passes. diff --git a/configure b/configure index 70819d2..0dda8b4 100755 --- a/configure +++ b/configure @@ -11852,7 +11852,7 @@ if test "x$VERSION_SCRIPT_FLAG" = "x"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -LDFLAGS="$SAVED_LDFLAGS" +LDFLAGS="$SAVED_LDFLAGS -lrt" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use version script when building libjpeg-turbo" >&5 $as_echo_n "checking whether to use version script when building libjpeg-turbo... " >&6; } diff --git a/configure.ac b/configure.ac old mode 100644 new mode 100755 index 3a26104..ec2b7c8 --- a/configure.ac +++ b/configure.ac @@ -172,7 +172,7 @@ if test "x$VERSION_SCRIPT_FLAG" = "x"; then VERSION_SCRIPT=no AC_MSG_RESULT(no) fi -LDFLAGS="$SAVED_LDFLAGS" +LDFLAGS="$SAVED_LDFLAGS -lrt" AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo]) AC_MSG_RESULT($VERSION_SCRIPT) diff --git a/djpeg.c b/djpeg.c index b24694b..da58782 100755 --- a/djpeg.c +++ b/djpeg.c @@ -50,6 +50,26 @@ static const char * const cdjpeg_message_table[] = { NULL }; +#define PROFILE_DECODING + +#ifdef PROFILE_DECODING +#include + +#define TIMER_DEFINE_VARS struct timespec starttime, endtime; +#define TIMER_GETDIFF_MS() (long)( (endtime.tv_sec - starttime.tv_sec)*1000 + (endtime.tv_nsec - starttime.tv_nsec)/1000000) +#define TIMER_START do { clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &starttime); } while (0) +#define TIMER_STOP do { clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &endtime); } while (0) +#define TIMER_PRINT(...) fprintf(stderr, __VA_ARGS__) + +#else + +#define TIMER_DEFINE_VARS do {} while (0) +#define TIMER_GETDIFF_MS do {} while (0) +#define TIMER_START do {} while (0) +#define TIMER_STOP do {} while (0) +#define TIMER_PRINT(...) do {} while (0) +