diff --git a/tools/gst-launch.c b/tools/gst-launch.c
index 05543f7..8269a7a 100755
--- a/tools/gst-launch.c
+++ b/tools/gst-launch.c
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <signal.h>
+#include <sys/time.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -38,6 +39,8 @@
 #endif
 #include <locale.h>             /* for LC_ALL */
 #include "tools.h"
+#include "gst/gstelement.h"
+#include "gst/gstpad.h"
 
 extern volatile gboolean glib_on_error_halt;
 
@@ -65,6 +68,45 @@ static gboolean waiting_eos = FALSE;
 
 /* convenience macro so we don't have to litter the code with if(!quiet) */
 #define PRINT if(!quiet)g_print
+GTimeVal        start_time;
+GTimeVal        end_time;
+GTimeVal        diff_time;
+
+struct timeval  s1time;
+struct timeval  etime;
+struct timeval  currenttime;
+struct timeval  result;
+struct tm*      ptm;
+long            count=0;
+long            past_count=0;
+struct          itimerval val, curval;
+gboolean        timer = FALSE;
+
+/* http://www.gnu.org/s/libc/manual/html_node/Elapsed-Time.html */
+int
+timeval_subtract (result, x, y)
+     struct timeval *result, *x, *y;
+{
+  /* Perform the carry for the later subtraction by updating y. */
+  if (x->tv_usec < y->tv_usec) {
+    int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
+    y->tv_usec -= 1000000 * nsec;
+    y->tv_sec += nsec;
+  }
+  if (x->tv_usec - y->tv_usec > 1000000) {
+    int nsec = (x->tv_usec - y->tv_usec) / 1000000;
+    y->tv_usec += 1000000 * nsec;
+    y->tv_sec -= nsec;
+  }
+
+  /* Compute the time remaining to wait.
+     tv_usec is certainly positive. */
+  result->tv_sec = x->tv_sec - y->tv_sec;
+  result->tv_usec = x->tv_usec - y->tv_usec;
+
+  /* Return 1 if result is negative. */
+  return x->tv_sec < y->tv_sec;
+}
 
 #ifdef G_OS_UNIX
 static void
@@ -876,6 +918,37 @@ bus_sync_handler (GstBus * bus, GstMessage * message, gpointer data)
   return GST_BUS_PASS;
 }
 
+void alarm_awake()
+{
+  long framesinsec=0;
+  static long past_count=0;
+
+  struct tm* tptr;
+  time_t t = time(NULL);
+
+  /*g_print ("alarm ticked every second\n"); */
+  framesinsec = count-past_count;
+
+  if (count > 0 && timer == TRUE) {
+           tptr = localtime(&t);
+           g_print ("FPS: %3d  TIME %02d:%02d:%02d\n",(int)framesinsec,tptr->tm_hour, tptr->tm_min, tptr->tm_sec);
+  }
+
+  past_count=count;
+}
+
+static gboolean
+cb_have_data_sink (GstPad  *pad,
+              GstBuffer *buffer,
+              gpointer   u_data)
+{
+  g_get_current_time (&end_time);
+  gettimeofday (&etime, NULL);
+  count=count+1;
+
+  return TRUE;
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -888,6 +961,7 @@ main (int argc, char *argv[])
 #endif
   gchar *savefile = NULL;
   gchar *exclude_args = NULL;
+  gchar *element_pad = NULL;
 #ifndef GST_DISABLE_OPTION_PARSING
   GOptionEntry options[] = {
     {"tags", 't', 0, G_OPTION_ARG_NONE, &tags,
@@ -906,6 +980,10 @@ main (int argc, char *argv[])
         N_("Do not install a fault handler"), NULL},
     {"eos-on-shutdown", 'e', 0, G_OPTION_ARG_NONE, &eos_on_shutdown,
         N_("Force EOS on sources before shutting the pipeline down"), NULL},
+    {"padprobe", 'p', 0, G_OPTION_ARG_STRING, &element_pad,
+        N_("Instrumentation metrics for calculating frames per second"), NULL},
+    {"timer", 'r', 0, G_OPTION_ARG_NONE, &timer,
+        N_("Display FPS timer every second"), NULL},
 #if 0
     {"index", 'i', 0, G_OPTION_ARG_NONE, &check_index,
         N_("Gather and print index statistics"), NULL},
@@ -982,6 +1060,49 @@ main (int argc, char *argv[])
     g_error_free (error);
     return 1;
   }
+  if (element_pad)
+  {
+    char e_name[50], e_pad[30];
+    GstElement *element = NULL;
+    GstPad *pad;
+    char *pch;
+    int l1, l2;
+
+    pch = strchr (element_pad, ':');
+    if (pch != NULL)
+        strncpy (e_name, element_pad, pch-element_pad + 1);
+    else{
+        g_print ("Couldn't find character ':'; -padprobe discarded.\n");
+        goto cont;
+    }
+
+    e_name[pch-element_pad] = '\0';
+    strcpy (e_pad, pch+1);
+    l1 = strlen (e_name);
+    l2 = strlen (e_pad);
+
+    /*
+    g_printf (" element = %s %d\n", e_name, l1);
+    g_printf (" pad = %s %d\n", e_pad, l2);
+    */
+
+    element = gst_bin_get_by_name (GST_BIN (pipeline), e_name);
+    if (element == NULL) {
+       g_print ("Couldn't find element %s; -padprobe discarded.\n", e_name);
+    }
+    else
+    {
+       pad = gst_element_get_static_pad (element, e_pad);
+       if (pad == NULL) {
+          g_print ("Couldn't find pad %s; -padprobe discarded.\n", e_pad);
+       } else
+          gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER, G_CALLBACK (cb_have_data_sink), NULL, NULL);
+       gst_object_unref (element);
+    }
+    /* TI change */
+  }
+
+cont:
 
   if (verbose) {
     gchar **exclude_list =
@@ -1082,6 +1203,16 @@ main (int argc, char *argv[])
         goto end;
       }
 
+      signal (SIGALRM, alarm_awake);
+
+      val.it_interval.tv_sec  = 1;      /* ie. every second */
+      val.it_interval.tv_usec = 0;
+      val.it_value.tv_sec     = 1;      /* initialise counter */
+      val.it_value.tv_usec    = 0;
+
+      setitimer (ITIMER_REAL, &val, 0);
+
+      g_get_current_time (&start_time);
       tfthen = gst_util_get_timestamp ();
       caught_error = event_loop (pipeline, TRUE, FALSE, GST_STATE_PLAYING);
       if (eos_on_shutdown && caught_error != ELR_NO_ERROR) {
@@ -1120,6 +1251,9 @@ main (int argc, char *argv[])
         }
       }
       tfnow = gst_util_get_timestamp ();
+      g_get_current_time (&end_time);
+
+      signal (SIGALRM, SIG_IGN);
 
       diff = GST_CLOCK_DIFF (tfthen, tfnow);
 
@@ -1155,6 +1289,17 @@ main (int argc, char *argv[])
     gst_element_set_state (pipeline, GST_STATE_NULL);
   }
 
+  timeval_subtract (&diff_time, &end_time, &start_time);
+  g_print ("Total time: %lf seconds\n", (float)diff_time.tv_sec + (float) diff_time.tv_usec / G_USEC_PER_SEC);
+
+  if (element_pad)
+  {
+    g_print ("Frames: %d processed\n", (int)count);
+
+     /* g_print ("Avg. FPS: %.2lf\n", (float) ((float)count / ((float)diff_time.tv_sec)+(float)diff_time.tv_usec) ); */
+      g_print ("Avg. FPS: %.2lf\n", (float)  (count / (float)(diff_time.tv_sec * G_USEC_PER_SEC + diff_time.tv_usec) * G_USEC_PER_SEC));
+  }
+
   PRINT (_("Freeing pipeline ...\n"));
   gst_object_unref (pipeline);
 
