• lysergik

    Hi I manage to get the perf tools source but don't know where I should put the -fno-omit-frame-pointer flag. All the tutrial I found show how to compile it with the makefile, so how do I put this gcc flag in the makefile ?

    posted in technical issues read more
  • lysergik

    Sorry for my misunderstanding, I've look up to see If there were a way to see calls which are nested to other ones, and I found this (https://fr.slideshare.net/emBO_Conference/profiling-your-applications-using-the-linux-perf-tools) on a slide there's a command to show what they call children calls. When I launch it I can see all the calls linked to a call by pressing enter. All I need now is to find the interesting calls such as DSP ticking ect...

    EDIT:
    Here's the childrencalls of the calls I've reported before:

    -   25,22%     6,90%  pd       libc-2.23.so        [.] vfprintf                                                                                                        
       - 18,32% vfprintf                                                                                                                                                   
          - 16,16% __GI___printf_fp_l                                                                                                                                      
               1,47% hack_digit                                                                                                                                            
               1,04% __mpn_mul_1                                                                                                                                           
               0,70% strlen                                                                                                                                                
            0,76% __strchrnul                                                                                                                                              
            0,65% _IO_file_xsputn@@GLIBC_2.2.5                                                                                                                             
       - 6,84% 0xffffffffffffffff                                                                                                                                          
          - 6,81% _start                                                                                                                                                   
               __libc_start_main                                                                                                                                           
               sys_run_scheduler                                                                                                                                           
               pd_extern_sched                                                                                                                                             
               __printf_chk                                                                                                                                                
               vfprintf                                                                                                                                                    
    -   16,60%    12,52%  pd       libc-2.23.so        [.] __GI___printf_fp_l                                                                                              
       - 12,44% 0xffffffffffffffff                                                                                                                                         
            _start                                                                                                                                                         
            __libc_start_main                                                                                                                                              
            sys_run_scheduler                                                                                                                                              
            pd_extern_sched                                                                                                                                                
          - __printf_chk                                                                                                                                                   
             - 12,42% vfprintf                                                                                                                                             
                  __GI___printf_fp_l                                                                                                                                       
       - 4,09% __GI___printf_fp_l                                                                                                                                          
            1,47% hack_digit                                                                                                                                               
            1,07% __mpn_mul_1                                                                                                                                              
            0,72% strlen     
    -   25,22%     6,90%  pd       libc-2.23.so        [.] vfprintf                                                                                                        
       - 18,32% vfprintf                                                                                                                                                   
          - 16,16% __GI___printf_fp_l                                                                                                                                      
               1,47% hack_digit                                                                                                                                            
               1,04% __mpn_mul_1                                                                                                                                           
               0,70% strlen                                                                                                                                                
            0,76% __strchrnul                                                                                                                                              
            0,65% _IO_file_xsputn@@GLIBC_2.2.5                                                                                                                             
       - 6,84% 0xffffffffffffffff                                                                                                                                          
          - 6,81% _start                                                                                                                                                   
               __libc_start_main                                                                                                                                           
               sys_run_scheduler                                                                                                                                           
               pd_extern_sched                                                                                                                                             
               __printf_chk                                                                                                                                                
               vfprintf                                                                                                                                                    
    -   16,60%    12,52%  pd       libc-2.23.so        [.] __GI___printf_fp_l                                                                                              
       - 12,44% 0xffffffffffffffff                                                                                                                                         
            _start                                                                                                                                                         
            __libc_start_main                                                                                                                                              
            sys_run_scheduler                                                                                                                                              
            pd_extern_sched                                                                                                                                                
          - __printf_chk                                                                                                                                                   
             - 12,42% vfprintf                                                                                                                                             
                  __GI___printf_fp_l                                                                                                                                       
       - 4,09% __GI___printf_fp_l                                                                                                                                          
            1,47% hack_digit                                                                                                                                               
            1,07% __mpn_mul_1                                                                                                                                              
            0,72% strlen         
    ...
    
    -   25,22%     6,90%  pd       libc-2.23.so        [.] vfprintf                                                                                                        
       - 18,32% vfprintf                                                                                                                                                   
          - 16,16% __GI___printf_fp_l                                                                                                                                      
               1,47% hack_digit                                                                                                                                            
               1,04% __mpn_mul_1                                                                                                                                           
               0,70% strlen                                                                                                                                                
            0,76% __strchrnul                                                                                                                                              
            0,65% _IO_file_xsputn@@GLIBC_2.2.5                                                                                                                             
       - 6,84% 0xffffffffffffffff                                                                                                                                          
          - 6,81% _start                                                                                                                                                   
               __libc_start_main                                                                                                                                           
               sys_run_scheduler                                                                                                                                           
               pd_extern_sched                                                                                                                                             
               __printf_chk                                                                                                                                                
               vfprintf                                                                                                                                                    
    -   16,60%    12,52%  pd       libc-2.23.so        [.] __GI___printf_fp_l                                                                                              
       - 12,44% 0xffffffffffffffff                                                                                                                                         
            _start                                                                                                                                                         
            __libc_start_main                                                                                                                                              
            sys_run_scheduler                                                                                                                                              
            pd_extern_sched                                                                                                                                                
          + __printf_chk                                                                                                                                                   
       - 4,09% __GI___printf_fp_l                                                                                                                                          
            1,47% hack_digit                                                                                                                                               
            1,07% __mpn_mul_1                                                                                                                                              
            0,72% strlen   
    
    

    Then I took a look to DSP-tick and sched-tick to see whats going there:

    -   66,16%     0,57%  pd       pd                  [.] dsp_tick                                                                                                        
       - 65,59% dsp_tick                                                                                                                                                   
          - 2,72% expr_perform                                                                                                                                             
             - 2,56% ex_eval                                                                                                                                               
                  2,27% eval_func                                                                                                                                          
            2,47% scalartimes_perf8                                                                                                                                        
            2,25% plus_perf8                                                                                                                                               
            2,19% times_perf8                                                                                                                                              
            1,30% 0x8754e                                                                                                                                                  
            1,23% 0x87487                                                                                                                                                  
            1,10% 0x8753f                                                                                                                                                  
            1,08% 0x87491                                                                                                                                                  
            1,05% voutlet_perform                                                                                                                                          
            0,63% 0x87478                                                                                                                                                  
            0,63% 0x87531                                                                                                                                                  
            0,63% minus_perf8                                                                                                                                              
            0,61% 0x7e4ff                                                                                                                                                  
            0,61% 0x7aebd                                                                                                                                                  
            0,60% 0x7e5a5                                                                                                                                                  
            0,60% 0x7e4b0                                                                                                                                                  
            0,60% 0x8755d                                                                                                                                                  
            0,57% 0x7e54b                                                                                                                                                  
          + 0,55% 0x830d7                                                                                                                                                  
          + 0,55% 0x83018                                                                                                                                                  
          + 0,54% 0x8311d                                                                                                                                                  
          + 0,53% 0x8308d                                                                                                                                                  
            0,51% 0x8746a    
    
    -   65,86%     0,03%  pd       pd                  [.] sched_tick                                                                                                      
         65,83% sched_tick                                                                                                                                                 
          - dsp_tick                                                                                                                                                       
             - 2,72% expr_perform                                                                                                                                          
                - 2,56% ex_eval                                                                                                                                            
                     2,27% eval_func                                                                                                                                       
               2,47% scalartimes_perf8                                                                                                                                     
               2,25% plus_perf8                                                                                                                                            
               2,19% times_perf8                                                                                                                                           
               1,30% 0x8754e                                                                                                                                               
               1,23% 0x87487                                                                                                                                               
               1,10% 0x8753f                                                                                                                                               
               1,08% 0x87491                                                                                                                                               
               1,05% voutlet_perform                                                                                                                                       
               0,63% 0x87478                                                                                                                                               
               0,63% 0x87531                                                                                                                                               
               0,63% minus_perf8                                                                                                                                           
               0,61% 0x7e4ff                                                                                                                                               
               0,61% 0x7aebd                                                                                                                                               
               0,60% 0x7e5a5                                                                                                                                               
               0,60% 0x7e4b0                                                                                                                                               
               0,60% 0x8755d                                                                                                                                               
               0,57% 0x7e54b                                                                                                                                               
             + 0,55% 0x830d7                                                                                                                                               
             + 0,55% 0x83018                                                                                                                                               
             + 0,54% 0x8311d                                                                                                                                               
             + 0,53% 0x8308d                                                                                                                                               
               0,51% 0x8746a 
    
    

    I've displayed the result for the 3 process for what seems problematic and then for DSP et Sched tick only write the output of one process since it's similar on every process. So the problems seems to come from the process __GI___printf_fp_l and vfprintf and not on other calls(which all seems to run fine. I tried to find vfprintf and __GL___Printf_fp_l because I couldn't find them when running perf on the osc~ 440 patch, so it seems those calls depends of my pd object.

    posted in technical issues read more
  • lysergik

    Well the result I've showed isn't from a global CPU counter(like htop), but it's the result I got by record event comming from the pure data process with perf(with a command like this perf record -p pid), even if there's recurent functions that are called by pd noramlly, they usally don"t run with as much CPU use. I could run a test with a very simple patch to see if the same function calls appear first or not, then we would know if the function calls perf reported are the one linking to the bottlneck.

    Edit: I've just run a perf test with a patch looking like this [osc~ 440]-[dac~]. This what perf sends me:
    "62,44% pd [kernel.kallsyms] [k] delay_tsc ▒
    19,19% pd [kernel.kallsyms] [k] pci_azx_readl "

    We see now that only delay_tsc is noramlly called by pd but all the other function called I quoted before are link to my patch.

    posted in technical issues read more
  • lysergik

    @Nicolas Danet Thanks for the tip, I didn't knew about Perf on linux it's very handy. I ran a test on each patch/subpatch and got the following:
    benchmark.jpg

    So I will serach about -GI__printf_fp_l _IO-vfscanf vfprintf plus_pcrf8 and delay_tsc to see to what they match in PD. But if GI_printf and vfprintf are calls used by PD for the GUI object then @alexandros was right and I will replace all GUI object by text ones.

    @EEight My problem with switch~ is not that I don't know how to use its syntax but more because splitting each sound processing patch in my patch would divide it into at least 16 different subpatch(probably more). And as far as I experimented the pd~ object I have noticed that running 9 subpatches took more ressources than just running 3. Considering this I'm not sure that implementing switch~ to my patch will introduce a significant gain of processing power. And it is the case it would be effecient if I only used few tracks out of the 8 track grroovebox that I'm working on, disable Fx ect.. and as soon I want to use the full capabilities of the patch it would crash because all the audio processing patch would run with the DSP and the CPU performances would rise again to what I got now.

    Maybe I didn't explain it very clearly, so I will rapidly explain it again. My main problem here is that my intitial patch(we'll called it v1) uses 10-12% of CPU, and my motherpatch for different processes(let's call it v2) uses 18-20% + subpatch 1 running at 12-15% and subpatch 2 8-10%. So I got a v1 is runniingn 50% on one core and V2 and its subpatches is running at 30-40 with peak at 60% on four cores. Which is kind of the worst optimization of the history of computing ^^. Though ginving the Perf result I have something to investigate to see where the problem come from. I'll give you update as soon as I found out what to do.

    EDIT: I did a bit of search it seems that IO-getc, GI-printf, IO-vfscanf and vfprintf are all functions used to manages stram of data. I'm not sure but I'm sending the value from my GUI/input patch to my auddi processing patch via netsend, maybe the way I'm doing it is not optimal, maybe I should switch to osc~ because it's more effective to stream large numbers of value. Maybe I messed up the way to through values into the subpatches(because if my netsending method is messy it does not explain why I see the same problematic function calls in the subpatches). It coould also be link to the GUI elements since data streaming could be used in in those. But it does not explain why there's the function call in my mother patch that isn't using any GUI elements. To get better result I will find directly in PD source code.

    EDIT 2: I found vfprintf in this PD source file "pa_debugprint.c" so it don't validate the few hypothesis I made before, but in my pd window I got repeated messages like "output snd_pcm_delay failed: Unknown error 476 astate 3" they could be the reason of this. Then I also found plus.perf8 here "d_arithmetic.c" it seems relied to operators (/ * = -) I use them to set value to my synth ect... so getting rid of them would be very difficult if not impossible.

    posted in technical issues read more
  • lysergik

    Thank you, I've read that removing GUI object helps for good performance, so if you recomend it I will remove all GUI. Since it's a lot of change to apply to my patch, I just want to know how effective this methode is in terms of CPU usage optimization. Giving the patch performance(audio processed with 35% of CPU) could I get the patch running at 20% of CPU or even less ?

    Then for the use of switch~ I don't know how I could implement that. The easier way would to place it to my FX section, but I don't know if spliting my FX subpatch in 8 or 9 would helps in term of efficiency. I noticed than I got better performance in my mother patch when I hosted only two subpatch instead of nine(like a gain of 5% of CPU).

    For the DSP crash on the RPI it seems that I'm not the only one to have some issues with it. The problem is coming from Alsa, I've tried running the dsp on jack and it works, for this one problem solved.

    posted in technical issues read more
  • lysergik

    Hello everyone, I'm currently working on somekind of "fork" of a patch I found(it's a groovebox patch coded by Martin Birkmann). It consume quite a lot of CPU, on my current Laptop equiped with an Intel® Core™ i3-6006U CPU, it ran up 50% on the first core. Since i want to be able to run it on a Raspberry Pi 3, running the patch at about 1 ghz on a single core is just not possible. Then I looked up how I could optimizes the use of the cpu, I tried to use some puredata command flag, tried to simplify and hide most of the GUI and even tried to split up the patch with subprocesses with pd~.

    First flags, changes of priority, realtime ect... doesn't do anything for the use of CPU. Secondly hiding some GUI maybe help to grab 1% or 2% of CPU. Finaly, I had great hope that pd~ would allow to spread the CPU all across the proccessor allowing me to run it on the RPI 3, but no it's strange the mother patch of the subprocesses is running at 18-20% of CPU use(about 60% on a single core) consuming more than the initial patch that runs at 10-12% of CPU use. And when I'm running the pd subprocesses they also grasp a load of cpu use, They consume about as much as the mother patch, which is quite the opposite of what I wanted...

    So is it normal that the use of pd~ just increases the need of CPU time for pd ? Is there another way to split the audio processing in different pd instances s the calculation is shared by different cores ? Is there some things I could improve in the audio processing section that could help lowering the use of CPU ?

    Then I have another problem whenever I wanted to activate the dsp when I was on my RPI pure data craches. Is there someone here that knows why ? What command should I use to use the dsp without crash on a rpi ?

    If you don't see any solution to my problem then you maybe can help me in an another way? Since my problem is mainly optimisation, if you have some recommandation to gave about some pure data open source groovebox patch that run well on low spec system it would be great.

    posted in technical issues read more
  • lysergik

    @whale-av Okay thanks ! It makes more sense explain this way than in the .help file.

    posted in technical issues read more
  • lysergik

    Hi guys, I'm working on a groovebox patch, thing are working well but for some reasons I need to split the processing value between the different core. So I began spliting my audio processing subpatch by puting them in pd~ subprocesses. All subprocesses run but I need to send value to them to get everything to work. So I tried sending messages such as it is described in the .help file of pd~ but it doesn't seem to work. It's probably just not doing it right so is there someone here that could explain me how the messages are sent from a parent patch to a subprocess ? And if there someone here able to sending me an example of code using the messages with pd~ it would be great.

    posted in technical issues read more

Internal error.

Oops! Looks like something went wrong!