
Instrumentation in pcm_lib.c ( core )

@@ -266,6 +266,10 @@ static void update_audio_tstamp(struct snd_pcm_substream *substream,
 	}
 	runtime->status->audio_tstamp = *audio_tstamp;
 	runtime->status->tstamp = *curr_tstamp;
+  trace_printk("Hello 2 %d \n", runtime->tstamp_type);  
+  trace_printk("Hello 3 %lld.%.9ld \n", (long long)runtime->status->tstamp.tv_sec,runtime->status->tstamp.tv_nsec);
+  trace_printk("Hello 3.1 %lld.%.9ld \n", (long long)runtime->status->audio_tstamp.tv_sec,runtime->status->audio_tstamp.tv_nsec);
+ 
 
 	/*
 	 * re-take a driver timestamp to let apps detect if the reference tstamp
@@ -1876,6 +1880,7 @@ void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)
 		return;
 	runtime = substream->runtime;
 
+  trace_printk("Hello 1 \n");
 	snd_pcm_stream_lock_irqsave(substream, flags);
 	if (!snd_pcm_running(substream) ||
 	    snd_pcm_update_hw_ptr0(substream, 1) < 0)












Instrumentation in alsasrc.c

@@ -882,6 +882,10 @@ xrun_recovery (GstAlsaSrc * alsa, snd_pcm_t * handle, gint err)
   return err;
 }
 
+gint trace_fd;
+
+
+
 static GstClockTime
 gst_alsasrc_get_timestamp (GstAlsaSrc * asrc)
 {
@@ -901,10 +905,12 @@ gst_alsasrc_get_timestamp (GstAlsaSrc * asrc)
     return GST_CLOCK_TIME_NONE;
   }
 
+  if (trace_fd >= 0) write(trace_fd, "USER_SPACE Hello 3\n", strlen("USER_SPACE Hello 3\n"));
   if (G_UNLIKELY (snd_pcm_status (asrc->handle, status) != 0)) {
     GST_ERROR_OBJECT (asrc, "snd_pcm_status failed");
     return GST_CLOCK_TIME_NONE;
   }
+  if (trace_fd >= 0) write(trace_fd, "USER_SPACE Hello 4\n", strlen("USER_SPACE Hello 4\n"));
 
   /* in case an xrun condition has occured we need to handle this */
   if (snd_pcm_status_get_state (status) != SND_PCM_STATE_RUNNING) {
@@ -948,12 +954,15 @@ gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length,
   gint cptr;
   guint8 *ptr = data;
 
+  trace_fd = open("/sys/kernel/debug/tracing/trace_marker", O_WRONLY);
+
   alsa = GST_ALSA_SRC (asrc);
 
   cptr = length / alsa->bpf;
 
   GST_ALSA_SRC_LOCK (asrc);
   while (cptr > 0) {
+    if (trace_fd >= 0) write(trace_fd, "USER_SPACE Hello 1\n", strlen("USER_SPACE Hello 1\n"));
     if ((err = snd_pcm_readi (alsa->handle, ptr, cptr)) < 0) {
       if (err == -EAGAIN) {
         GST_DEBUG_OBJECT (asrc, "Read error: %s", snd_strerror (err));
@@ -965,7 +974,7 @@ gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length,
       }
       continue;
     }
-
+    if (trace_fd >= 0) write(trace_fd, "USER_SPACE Hello 2\n", strlen("USER_SPACE Hello 2\n"));
     ptr += snd_pcm_frames_to_bytes (alsa->handle, err);
     cptr -= err;
   }
@@ -975,6 +984,8 @@ gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length,
   if (alsa->driver_timestamps && timestamp)
     *timestamp = gst_alsasrc_get_timestamp (alsa);
 
+  close(trace_fd);  
