Csound Csound-dev Csound-tekno Search About

[Csnd] Getting the processing time of current code (help)

Date2019-12-26 04:21
Fromslobodanip
Subject[Csnd] Getting the processing time of current code (help)
Hello csounders, I'm here again. I usually like to think ahead and that's why
I would like to know if it is possible to get the processing time of a chunk
of code. Purpose? To assign a "ksmps" big enough to not have problems. Like
I can be sure that the processing time of the chunk of code is faster than
the k-cycle time. Does this make sense for you?

I read in Csound book that ksmps should be around 10 - 100 times smaller
than "sr" for better performance? Is this related to previous questions
right? (Now I wonder what really means performance, mmm)

Any suggestions?
Thank you.



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-12-26 09:52
FromPeter Burgess
SubjectRe: [Csnd] Getting the processing time of current code (help)
A smaller control rate / kr (which results from a larger ksmps) is better for performance because you're calculating a control value fewer times per second. Also depending on the underlying algorithm of the audio rate opcodes used, you might get a better performance from a larger ksmps because you're calculating a larger array of audio samples at a time per control tick. Forgive me if you're aware of this, but to make sure we're on the same page, Csound performs a processing cycle every 1/kr seconds. On each of these processing cycles, every audio rate opcode generates ksmps worth of audio samples and every control rate opcode generates a single control value.

Due to where the performance speed up comes from when adjusting ksmps, there's no built in way of measuring the performance difference from varying the value of kr/ksmps. I expect the impact will be slightly different per audio opcode, and with various architectures and optimisation types impacting the performance, the only real way to measure it would be to time it. I have no idea if there's a global processing loop timer you can access, one of the Csound veterans will know better, but I'd expect it would only exist in a debug build if it did, which won't help with your calculating ksmps before performance plan.

On Thu, 26 Dec 2019, 04:03 slobodanip, <slobodanip@gmail.com> wrote:
Hello csounders, I'm here again. I usually like to think ahead and that's why
I would like to know if it is possible to get the processing time of a chunk
of code. Purpose? To assign a "ksmps" big enough to not have problems. Like
I can be sure that the processing time of the chunk of code is faster than
the k-cycle time. Does this make sense for you?

I read in Csound book that ksmps should be around 10 - 100 times smaller
than "sr" for better performance? Is this related to previous questions
right? (Now I wonder what really means performance, mmm)

Any suggestions?
Thank you.



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-12-26 16:08
Fromjohn
SubjectRe: [Csnd] Getting the processing time of current code (help)
Not sure exactly what you want but clockon/clockoff and readclock may be 
of help.

For more detailed information I have used valgrind and counted 
instructions in rhe perf and init functions for a single opcode.  Never 
published the results and it is crying out for automation.  Mau have some 
results lying about.

==John ff


On Wed, 25 Dec 2019, slobodanip wrote:

> Hello csounders, I'm here again. I usually like to think ahead and that's why
> I would like to know if it is possible to get the processing time of a chunk
> of code. Purpose? To assign a "ksmps" big enough to not have problems. Like
> I can be sure that the processing time of the chunk of code is faster than
> the k-cycle time. Does this make sense for you?
>
> I read in Csound book that ksmps should be around 10 - 100 times smaller
> than "sr" for better performance? Is this related to previous questions
> right? (Now I wonder what really means performance, mmm)
>
> Any suggestions?
> Thank you.
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2020-01-13 02:57
Fromslobodanip
SubjectRe: [Csnd] Getting the processing time of current code (help)
Thank you John. Mainly I was asking because I wanted to measure the
processing time to get to know if the ksmps value is ok. So I don't have
zipper sounds or the error on the other side (contrary to zipper sounds).

Is this the right approach?

Cheers



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here