Christian,
(Resend - apologies for the previous direct send to you.)
Compiled LS with "-O3 -pg -g" flags.  Discovered gprof does not work with c++ (c, fortran and asm only)  wasted an afternoon, should have read the first line of the man page more carefully (doh).
Oprofile  needs to be compiled from source for my Os but did find Sysprof available for quick install.  I have attached a capture output summary that includes the failure mode I described previously. The summary zeros in on the heaviest loads.

I'm hoping for some advice.    I will look at the code myself sometime this week.
Thanks again for your help,
Doug

On Sat, 26 Aug 2023 at 16:55, Christian Schoenebeck <schoeneb...@linuxsampler.org> wrote:
On Friday, August 25, 2023 3:14:13 PM CEST Doug Gray wrote:
> Christian,
> Reading and testing the example given here I can see the process.
> https://www.thegeekstuff.com/2012/08/gprof-tutorial/
>
> From your directions to Ebab in 2020 I surmise the command line would be:
>
> CXXFLAGS="-O3 -pg -j4" ./configure && make

You should also add -g to add debug information.

> and execute:
>
> ./src/linuxsampler
>
> I presume -O3 are optimisations,   

Correct

> -pg  is from the current man page for gprof, 

Yeah, but that's only for gprof. It injects extra profiling code directly into
the binary. Other profilers like oprofile AFAICR don't need or use that.

> and -j4 to compile using  4 cores.  Is this correct?

Correct, and not important in this case. It just speeds up the compilation.

> (I understand not to  strip the executable.)

Correct.

It's been a long time that I used gprof or oprofile, so not sure whether the
situation has improved on gprof's end, but back then (years ago) gprof had the
huge disadvantage that it was only capable to profile on application binary
level only, whereas oprofile profiled from application binary level over
individual system libraries, down to lowest kernel level. So oprofile
delivered a much more complete and accurate picture than gprof.

For instance in this case of this SFZ engine issue, it could also be possible
that the bottle neck is somewhere in libsndfile or any library that libsndfile
calls in turn. gprof would not have revealed performance issues in libsndfile
or any other system lib, as it simply did not count those in.

The gig engine does not use any third-party lib during playback of samples.
The SFZ engine however supports a large number of all kinds of audio files.
That's why the SFZ engine calls libsndfile (also during real-time playback of
samples) to delegate support for all those file formats. And I'm not sure if
libsndfile and all the libs that libsndfile calls are designed to be real-time
safe.

/Christian




_______________________________________________
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel
      SELF      TOTAL    FUNCTION
[   0.00%] [  82.34%]    
[/home/pi/LinuxSampler/lssvn/linuxsampler/src/.libs/linuxsampler 
--exec-after-init 'nc -Nt localhost 8888 < startup.lscp; sleep 
3;./ls-helper/setprio.rc']
[   0.00%] [  82.33%]      thread_start
[   0.00%] [  82.33%]        start_thread
[   0.00%] [  82.33%]          LinuxSampler::Thread::pthreadLauncher(void*)
[   0.01%] [  61.69%]            LinuxSampler::AudioOutputDeviceAlsa::Main()
[   0.01%] [  61.05%]              
LinuxSampler::AudioOutputDevice::RenderAudio(unsigned int)
[   0.75%] [  59.26%]                
LinuxSampler::EngineBase<LinuxSampler::sfz::Voice, sfz::Region, sfz::Region, 
LinuxSampler::sfz::DiskThread, LinuxSampler::sfz::InstrumentResourceManager, 
sfz::Instrument>::RenderAudio(unsigned int)
[   0.83%] [   0.91%]                comb_run
[   0.26%] [   0.28%]                allp_run
[   0.17%] [   0.21%]                run_Reverb
[   0.16%] [   0.18%]                run_ChorusFlanger
[   0.04%] [   0.04%]                In file 
/home/pi/LinuxSampler/lssvn/linuxsampler/src/.libs/liblinuxsampler.so.6.0.0
[   0.01%] [   0.04%]                
LinuxSampler::EffectChain::RenderAudio(unsigned int)
[   0.01%] [   0.02%]                
LinuxSampler::AudioChannel::MixTo(LinuxSampler::AudioChannel*, unsigned int)
[   0.01%] [   0.01%]                
LinuxSampler::EngineChannel::SetDiskStreamCount(unsigned int)
[   0.00%] [   0.01%]                
LinuxSampler::AudioOutputDevice::ChannelCount()
[   0.01%] [   0.01%]                In file /usr/lib/ladspa/tap_reverb.so
[   0.01%] [   0.01%]                sincosf
[   0.01%] [   0.01%]                
LinuxSampler::AbstractEngine::RouteAudio(LinuxSampler::EngineChannel*, unsigned 
int)
[   0.00%] [   0.01%]                
LinuxSampler::Effect::OutputChannel(unsigned int) const
[   0.00%] [   0.01%]                LinuxSampler::EffectChain::EffectCount() 
const
[   0.00%] [   0.01%]                LinuxSampler::Effect::OutputChannelCount() 
const
[   0.00%] [   0.01%]                
LinuxSampler::EffectChain::ClearAllChannels()
[   0.00%] [   0.58%]              LinuxSampler::AudioOutputDeviceAlsa::Output()
[   0.01%] [   0.01%]              In file 
/home/pi/LinuxSampler/lssvn/linuxsampler/src/.libs/liblinuxsampler.so.6.0.0
[   0.01%] [   0.01%]              In file 
/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.28
[   0.00%] [   0.01%]              - - kernel - -
[   0.00%] [   0.01%]              LinuxSampler::Thread::pushCancelable(bool)
[   0.00%] [   0.01%]              LinuxSampler::Thread::popCancelable()
[   0.06%] [  15.52%]            LinuxSampler::InstrumentManagerThread::Main()
[   0.01%] [  10.97%]              std::_Function_handler<void (), 
LinuxSampler::sfz::InstrumentResourceManager::SfzResourceManager::Create(std::__cxx11::basic_string<char,
 std::char_traits<char>, std::allocator<char> >, 
LinuxSampler::ResourceConsumer<sfz::File>*, 
void*&)::{lambda()#1}>::_M_invoke(std::_Any_data const&)
[   0.15%] [  10.69%]                
sfz::File::checkFileModified(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >)
[   1.70%] [   9.28%]                  __xstat64
[   0.06%] [   0.37%]                  
sfz::File::getModTimeOfFile(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >)
[   0.26%] [   0.26%]                  __aarch64_cas8_acq
[   0.03%] [   0.14%]                  void std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, 
char*, std::forward_iterator_tag) [clone .constprop.0]
[   0.10%] [   0.11%]                  bcmp
[   0.09%] [   0.09%]                  _int_free
[   0.01%] [   0.06%]                  operator new(unsigned long)
[   0.06%] [   0.06%]                  free
[   0.05%] [   0.06%]                  _mcount@@GLIBC_2.18
[   0.04%] [   0.04%]                  In file 
/home/pi/LinuxSampler/lssvn/linuxsampler/src/.libs/liblinuxsampler.so.6.0.0
[   0.02%] [   0.02%]                  In file 
/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.28
[   0.01%] [   0.02%]                  __profil_counter
[   0.00%] [   0.01%]                  - - kernel - -
[   0.01%] [   0.01%]                  __memcpy_generic
[   0.00%] [   0.01%]                  In file [vdso]
[   0.19%] [   0.20%]                __aarch64_cas8_acq
[   0.04%] [   0.04%]                In file 
/home/pi/LinuxSampler/lssvn/linuxsampler/src/.libs/liblinuxsampler.so.6.0.0
[   0.01%] [   0.01%]                std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, 
unsigned long)
[   0.01%] [   0.01%]                
std::_Rb_tree_increment(std::_Rb_tree_node_base*)
[   0.01%] [   0.01%]                __memcpy_generic
[   0.01%] [   0.01%]                operator delete(void*)
[   0.01%] [   0.01%]                _mcount@@GLIBC_2.18
[   0.05%] [   0.76%]              std::_Function_handler<void (), 
LinuxSampler::sfz::InstrumentResourceManager::SfzResourceManager::Create(std::__cxx11::basic_string<char,
 std::char_traits<char>, std::allocator<char> >, 
LinuxSampler::ResourceConsumer<sfz::File>*, 
void*&)::{lambda()#1}>::_M_manager(std::_Any_data&, std::_Function_handler<void 
(), 
LinuxSampler::sfz::InstrumentResourceManager::SfzResourceManager::Create(std::__cxx11::basic_string<char,
 std::char_traits<char>, std::allocator<char> >, 
LinuxSampler::ResourceConsumer<sfz::File>*, void*&)::{lambda()#1}> const&, 
std::_Manager_operation)
[   0.02%] [   0.75%]              
LinuxSampler::InstrumentManagerThread::AnyPeriodicJobs()
[   0.01%] [   0.41%]              LinuxSampler::Mutex::Unlock()
[   0.00%] [   0.36%]              LinuxSampler::Mutex::Lock()
[   0.01%] [   0.32%]              
LinuxSampler::Condition::WaitIfInternal(bool, bool, long, long)
[   0.02%] [   0.29%]              LinuxSampler::Thread::pushCancelable(bool)
[   0.02%] [   0.26%]              LinuxSampler::Thread::popCancelable()
[   0.00%] [   0.20%]              LinuxSampler::Thread::TestCancel()
[   0.01%] [   0.18%]              LinuxSampler::Condition::WaitIf(bool, long, 
long)
[   0.14%] [   0.15%]              __kernel_gettimeofday
[   0.12%] [   0.13%]              __aarch64_swp4_rel
[   0.12%] [   0.12%]              __aarch64_cas4_acq
[   0.11%] [   0.11%]              In file 
/home/pi/LinuxSampler/lssvn/linuxsampler/src/.libs/liblinuxsampler.so.6.0.0
[   0.08%] [   0.08%]              free
[   0.07%] [   0.07%]              __pthread_mutex_lock
[   0.05%] [   0.06%]              __pthread_mutex_unlock_usercnt
[   0.04%] [   0.04%]              _mcount@@GLIBC_2.18
[   0.01%] [   0.04%]              operator new(unsigned long)
[   0.04%] [   0.04%]              pthread_setcancelstate
[   0.03%] [   0.03%]              __memcpy_generic
[   0.03%] [   0.03%]              _int_free
[   0.01%] [   0.01%]              In file 
/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.28
[   0.00%] [   0.01%]              In file [vdso]
[   0.01%] [   0.01%]              _dl_tlsdesc_return
[   0.01%] [   0.01%]              pthread_testcancel
[   0.01%] [   0.01%]              operator delete(void*, unsigned long)
[   0.07%] [   4.65%]            LinuxSampler::DiskThreadBase<sfz::Region, 
LinuxSampler::sfz::InstrumentResourceManager>::Main()
[   0.00%] [   2.64%]              
LinuxSampler::StreamBase<sfz::Region>::ReadAhead(unsigned long)
[   0.01%] [   2.61%]                LinuxSampler::sfz::Stream::Read(unsigned 
char*, long)
[   0.00%] [   2.34%]                  LinuxSampler::SampleFile::Read(void*, 
unsigned long)
[   0.01%] [   0.19%]                  sf_seek
[   0.01%] [   0.01%]                  In file 
/usr/lib/aarch64-linux-gnu/libsndfile.so.1.0.31
[   0.01%] [   0.01%]                  sfz::Region::HasLoop()
[   0.01%] [   0.01%]                  
LinuxSampler::SampleFile::SetPos(unsigned long, int)
[   0.01%] [   0.01%]                  __aarch64_cas8_acq
[   0.01%] [   0.01%]                  sf_read_raw
[   0.00%] [   0.01%]                  LinuxSampler::SampleFile::GetPos()
[   0.01%] [   0.02%]                __aarch64_cas8_acq
[   0.00%] [   1.76%]              qsort_r
[   0.10%] [   1.70%]                msort_with_tmp.part.0
[   0.01%] [   0.02%]                __aarch64_cas4_acq
[   0.00%] [   0.01%]                __libc_malloc
[   0.01%] [   0.01%]                _int_free
[   0.00%] [   0.01%]                __memcpy_generic
[   0.01%] [   0.11%]              LinuxSampler::sfz::Stream::Launch(unsigned 
int, LinuxSampler::Stream::reference_t*, sfz::Region*, unsigned long, bool)
[   0.00%] [   0.02%]              usleep
[   0.01%] [   0.01%]              __memcpy_generic
[   0.01%] [   0.01%]              In file 
/home/pi/LinuxSampler/lssvn/linuxsampler/src/.libs/liblinuxsampler.so.6.0.0
[   0.01%] [   0.01%]              pthread_setcancelstate
[   0.01%] [   0.01%]              LinuxSampler::Thread::popCancelable()
[   0.01%] [   0.01%]              LinuxSampler::sfz::Stream::Kill()
[   0.00%] [   0.01%]              LinuxSampler::Thread::pushCancelable(bool)
[   0.00%] [   0.14%]            LinuxSampler::MidiInputDeviceAlsa::Main()
[   0.00%] [   0.12%]            LinuxSampler::LSCPServer::Main()
[   0.07%] [   0.07%]            In file 
/home/pi/LinuxSampler/lssvn/linuxsampler/src/.libs/liblinuxsampler.so.6.0.0
[   0.05%] [   0.05%]            __memcpy_generic
[   0.03%] [   0.03%]            In file 
/usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.28
[   0.01%] [   0.01%]            LinuxSampler::Thread::TestCancel()
[   0.01%] [   0.01%]            pthread_setcancelstate
[   0.01%] [   0.01%]            
std::_Rb_tree_node<LinuxSampler::EngineChannel*>* 
std::_Rb_tree<LinuxSampler::EngineChannel*, LinuxSampler::EngineChannel*, 
std::_Identity<LinuxSampler::EngineChannel*>, 
std::less<LinuxSampler::EngineChannel*>, 
std::allocator<LinuxSampler::EngineChannel*> 
>::_M_copy<std::_Rb_tree<LinuxSampler::EngineChannel*, 
LinuxSampler::EngineChannel*, std::_Identity<LinuxSampler::EngineChannel*>, 
std::less<LinuxSampler::EngineChannel*>, 
std::allocator<LinuxSampler::EngineChannel*> 
>::_Alloc_node>(std::_Rb_tree_node<LinuxSampler::EngineChannel*> const*, 
std::_Rb_tree_node_base*, std::_Rb_tree<LinuxSampler::EngineChannel*, 
LinuxSampler::EngineChannel*, std::_Identity<LinuxSampler::EngineChannel*>, 
std::less<LinuxSampler::EngineChannel*>, 
std::allocator<LinuxSampler::EngineChannel*> >::_Alloc_node&) [clone .isra.0]
[   0.01%] [   0.01%]            LinuxSampler::Thread::popCancelable()
[   0.01%] [   0.01%]            __pthread_mutex_lock
[   0.01%] [   0.01%]            LinuxSampler::Condition::WaitIf(bool, long, 
long)
[   0.01%] [   0.01%]            LinuxSampler::sfz::Stream::Kill()
[   0.01%] [   0.01%]            LinuxSampler::Mutex::Unlock()
[   0.00%] [   0.01%]      _start

_______________________________________________
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel

Reply via email to