All of lore.kernel.org
 help / color / mirror / Atom feed
* RFC: Add support for monotonic clock for 2.6
@ 2007-02-27 14:52 Jaroslav Kysela
  2007-03-07 22:18 ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Jaroslav Kysela @ 2007-02-27 14:52 UTC (permalink / raw)
  To: ALSA development

Hi,

	in 2.6 kernels, we can use ktime_get_ts() function to get 
monotonic time which can be used for PCM timestamps. I would propose to 
reuse the SNDRV_PCM_IOCTL_TSTAMP ioctl to enable using of monotonic clock.
The "enable" (int) argument might mean:

0: standard clock - getnstimeofday()
1: standard clock - getnstimeofday() - for "compatibility"
2: monotonic clock - ktime_get_ts()

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: Add support for monotonic clock for 2.6
  2007-02-27 14:52 RFC: Add support for monotonic clock for 2.6 Jaroslav Kysela
@ 2007-03-07 22:18 ` Takashi Iwai
  2007-03-07 22:33   ` James Courtier-Dutton
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2007-03-07 22:18 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: ALSA development

At Tue, 27 Feb 2007 15:52:41 +0100 (CET),
Jaroslav Kysela wrote:
> 
> Hi,
> 
> 	in 2.6 kernels, we can use ktime_get_ts() function to get 
> monotonic time which can be used for PCM timestamps. I would propose to 
> reuse the SNDRV_PCM_IOCTL_TSTAMP ioctl to enable using of monotonic clock.
> The "enable" (int) argument might mean:
> 
> 0: standard clock - getnstimeofday()
> 1: standard clock - getnstimeofday() - for "compatibility"
> 2: monotonic clock - ktime_get_ts()

Good to add a new feature...  but is there any user of this PCM
timestamp so far?  I see some good purposes but rarely seen in the
reality, unfortunately...


Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: Add support for monotonic clock for 2.6
  2007-03-07 22:18 ` Takashi Iwai
@ 2007-03-07 22:33   ` James Courtier-Dutton
  2007-03-07 22:48     ` Takashi Iwai
  2007-03-08  6:57     ` Jaroslav Kysela
  0 siblings, 2 replies; 7+ messages in thread
From: James Courtier-Dutton @ 2007-03-07 22:33 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA development, Jaroslav Kysela

Takashi Iwai wrote:
> At Tue, 27 Feb 2007 15:52:41 +0100 (CET),
> Jaroslav Kysela wrote:
>> Hi,
>>
>> 	in 2.6 kernels, we can use ktime_get_ts() function to get 
>> monotonic time which can be used for PCM timestamps. I would propose to 
>> reuse the SNDRV_PCM_IOCTL_TSTAMP ioctl to enable using of monotonic clock.
>> The "enable" (int) argument might mean:
>>
>> 0: standard clock - getnstimeofday()
>> 1: standard clock - getnstimeofday() - for "compatibility"
>> 2: monotonic clock - ktime_get_ts()
> 
> Good to add a new feature...  but is there any user of this PCM
> timestamp so far?  I see some good purposes but rarely seen in the
> reality, unfortunately...
> 
> 
> Takashi
> 

There are some good applications for it, but I have not got round to 
writing them yet!

James




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: Add support for monotonic clock for 2.6
  2007-03-07 22:33   ` James Courtier-Dutton
@ 2007-03-07 22:48     ` Takashi Iwai
  2007-03-07 23:03       ` James Courtier-Dutton
  2007-03-08  6:57     ` Jaroslav Kysela
  1 sibling, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2007-03-07 22:48 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: ALSA development, Jaroslav Kysela

At Wed, 07 Mar 2007 22:33:25 +0000,
James Courtier-Dutton wrote:
> 
> Takashi Iwai wrote:
> > At Tue, 27 Feb 2007 15:52:41 +0100 (CET),
> > Jaroslav Kysela wrote:
> >> Hi,
> >>
> >> 	in 2.6 kernels, we can use ktime_get_ts() function to get 
> >> monotonic time which can be used for PCM timestamps. I would propose to 
> >> reuse the SNDRV_PCM_IOCTL_TSTAMP ioctl to enable using of monotonic clock.
> >> The "enable" (int) argument might mean:
> >>
> >> 0: standard clock - getnstimeofday()
> >> 1: standard clock - getnstimeofday() - for "compatibility"
> >> 2: monotonic clock - ktime_get_ts()
> > 
> > Good to add a new feature...  but is there any user of this PCM
> > timestamp so far?  I see some good purposes but rarely seen in the
> > reality, unfortunately...
> > 
> > 
> > Takashi
> > 
> 
> There are some good applications for it, but I have not got round to 
> writing them yet!

Me too ;)  But, I remember some difficulties regarding the
timestamping at the last time I tried (quite ago).  The timestamp is
somewhat hard to use because it's updated at each pointer or status
update although I wanted to get the exact time only at the period
boundary.  Maybe these usability issues should be sorted out all
together.


Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: Add support for monotonic clock for 2.6
  2007-03-07 22:48     ` Takashi Iwai
@ 2007-03-07 23:03       ` James Courtier-Dutton
  2007-03-08  7:01         ` Jaroslav Kysela
  0 siblings, 1 reply; 7+ messages in thread
From: James Courtier-Dutton @ 2007-03-07 23:03 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA development, Jaroslav Kysela

Takashi Iwai wrote:
> At Wed, 07 Mar 2007 22:33:25 +0000,
> James Courtier-Dutton wrote:
>> Takashi Iwai wrote:
>>> At Tue, 27 Feb 2007 15:52:41 +0100 (CET),
>>> Jaroslav Kysela wrote:
>>>> Hi,
>>>>
>>>> 	in 2.6 kernels, we can use ktime_get_ts() function to get 
>>>> monotonic time which can be used for PCM timestamps. I would propose to 
>>>> reuse the SNDRV_PCM_IOCTL_TSTAMP ioctl to enable using of monotonic clock.
>>>> The "enable" (int) argument might mean:
>>>>
>>>> 0: standard clock - getnstimeofday()
>>>> 1: standard clock - getnstimeofday() - for "compatibility"
>>>> 2: monotonic clock - ktime_get_ts()
>>> Good to add a new feature...  but is there any user of this PCM
>>> timestamp so far?  I see some good purposes but rarely seen in the
>>> reality, unfortunately...
>>>
>>>
>>> Takashi
>>>
>> There are some good applications for it, but I have not got round to 
>> writing them yet!
> 
> Me too ;)  But, I remember some difficulties regarding the
> timestamping at the last time I tried (quite ago).  The timestamp is
> somewhat hard to use because it's updated at each pointer or status
> update although I wanted to get the exact time only at the period
> boundary.  Maybe these usability issues should be sorted out all
> together.
> 
> 
> Takashi

Yes, timestamp at period boundary would be more useful. I had not looked 
at the current timestamp in enough details. A timestamp generated in the 
IRQ routine would probably be the best. Could the timestamp be attached 
to a particular PCM sample in the buffer. I.e. The app would retrieve 
the timestamp, and be told that that timestamp applies to the sample X 
samples from now, if using the snd_pcm_read() function.

James


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: Add support for monotonic clock for 2.6
  2007-03-07 22:33   ` James Courtier-Dutton
  2007-03-07 22:48     ` Takashi Iwai
@ 2007-03-08  6:57     ` Jaroslav Kysela
  1 sibling, 0 replies; 7+ messages in thread
From: Jaroslav Kysela @ 2007-03-08  6:57 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: Takashi Iwai, ALSA development

On Wed, 7 Mar 2007, James Courtier-Dutton wrote:

> Takashi Iwai wrote:
> > At Tue, 27 Feb 2007 15:52:41 +0100 (CET),
> > Jaroslav Kysela wrote:
> > > Hi,
> > > 
> > > 	in 2.6 kernels, we can use ktime_get_ts() function to get
> > > monotonic time which can be used for PCM timestamps. I would propose
> > > to reuse the SNDRV_PCM_IOCTL_TSTAMP ioctl to enable using of
> > > monotonic clock.
> > > The "enable" (int) argument might mean:
> > > 
> > > 0: standard clock - getnstimeofday()
> > > 1: standard clock - getnstimeofday() - for "compatibility"
> > > 2: monotonic clock - ktime_get_ts()
> > 
> > Good to add a new feature...  but is there any user of this PCM
> > timestamp so far?  I see some good purposes but rarely seen in the
> > reality, unfortunately...
> > 
> > 
> > Takashi
> > 
> 
> There are some good applications for it, but I have not got round to writing
> them yet!

I'd like to use these timestamps to do jitter (sample rate) corrections 
among multiple soundcards. Unfortunately, because gettimeofday is not 
monotonic, the timestamps are not accurate enough. Also, direct plugins 
might use these timestamps to do more accurate stream start.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: Add support for monotonic clock for 2.6
  2007-03-07 23:03       ` James Courtier-Dutton
@ 2007-03-08  7:01         ` Jaroslav Kysela
  0 siblings, 0 replies; 7+ messages in thread
From: Jaroslav Kysela @ 2007-03-08  7:01 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: Takashi Iwai, ALSA development

On Wed, 7 Mar 2007, James Courtier-Dutton wrote:

> Takashi Iwai wrote:
> > At Wed, 07 Mar 2007 22:33:25 +0000,
> > James Courtier-Dutton wrote:
> > > Takashi Iwai wrote:
> > > > At Tue, 27 Feb 2007 15:52:41 +0100 (CET),
> > > > Jaroslav Kysela wrote:
> > > > > Hi,
> > > > > 
> > > > > 	in 2.6 kernels, we can use ktime_get_ts() function to
> > > > > get monotonic time which can be used for PCM timestamps. I
> > > > > would propose to reuse the SNDRV_PCM_IOCTL_TSTAMP ioctl to
> > > > > enable using of monotonic clock.
> > > > > The "enable" (int) argument might mean:
> > > > > 
> > > > > 0: standard clock - getnstimeofday()
> > > > > 1: standard clock - getnstimeofday() - for "compatibility"
> > > > > 2: monotonic clock - ktime_get_ts()
> > > > Good to add a new feature...  but is there any user of this PCM
> > > > timestamp so far?  I see some good purposes but rarely seen in
> > > > the
> > > > reality, unfortunately...
> > > > 
> > > > 
> > > > Takashi
> > > > 
> > > There are some good applications for it, but I have not got round to
> > > writing them yet!
> > 
> > Me too ;)  But, I remember some difficulties regarding the
> > timestamping at the last time I tried (quite ago).  The timestamp is
> > somewhat hard to use because it's updated at each pointer or status
> > update although I wanted to get the exact time only at the period
> > boundary.  Maybe these usability issues should be sorted out all
> > together.
> > 
> > 
> > Takashi
> 
> Yes, timestamp at period boundary would be more useful. I had not looked at
> the current timestamp in enough details. A timestamp generated in the IRQ
> routine would probably be the best. Could the timestamp be attached to a
> particular PCM sample in the buffer. I.e. The app would retrieve the
> timestamp, and be told that that timestamp applies to the sample X samples
> from now, if using the snd_pcm_read() function.

If SNDRV_PCM_TSTAMP_MMAP is set 
(snd_pcm_sw_params_set_tstamp_mode(SND_PCM_TSTAMP_MMAP)) , the timestamp 
is updated at each change of hw_ptr in driver (thus also in the interrupt 
handler).

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-03-08  7:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27 14:52 RFC: Add support for monotonic clock for 2.6 Jaroslav Kysela
2007-03-07 22:18 ` Takashi Iwai
2007-03-07 22:33   ` James Courtier-Dutton
2007-03-07 22:48     ` Takashi Iwai
2007-03-07 23:03       ` James Courtier-Dutton
2007-03-08  7:01         ` Jaroslav Kysela
2007-03-08  6:57     ` Jaroslav Kysela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.