I've created a btm to process flac files in various ways; test them, convert wav to flac, reconvert a flac file to my compression settings, etc. I run the number of instances of flac.exe as I have threads. I've discovered that getting the number of currently running flac instances is slow. I use
rem numproc is the number of files I've processed. I skip the number of flac instances stuff until I get above the number of threads I have to save time.
:processfile [filename]
iff %numproc% ge %number_of_processors then
set ninstancetext=%@pid[%program.exe, +]
iff %ninstancetext ne 0 then
set ninstances=%@words[%ninstancetext]
else
set ninstances=0
endiff
else
set ninstances=%numproc%
endiff
iff %ninstances lt %number_of_processors then
set numproc=%@inc[%numproc%]
iff %testmode eq 0 then
echos Processing ``
else
echos Testing ``
endiff
echo %filename
start /inv /belownormal %program %flacswitches %filename
else
delay /m 100
goto processfile
endiff
return
On my Ryzen 7950X Each of the %@pid calls takes about .1 seconds. I tried processmonitor, but it doesn't seem to allow me to keep track of how many processes are running
processmonitor notepad.exe started forever beep 300
processmonitor notepad.exe ended forever beep 600
The following happens:
1. Run notepad and hear the 300 HZ beep.
2. Run another notepad and hear nothing.
3. Close the second notepad and hear nothing.
4. Close the first notepad and hear the 600 HZ beep.
Any ideas would be helpful.
rem numproc is the number of files I've processed. I skip the number of flac instances stuff until I get above the number of threads I have to save time.
:processfile [filename]
iff %numproc% ge %number_of_processors then
set ninstancetext=%@pid[%program.exe, +]
iff %ninstancetext ne 0 then
set ninstances=%@words[%ninstancetext]
else
set ninstances=0
endiff
else
set ninstances=%numproc%
endiff
iff %ninstances lt %number_of_processors then
set numproc=%@inc[%numproc%]
iff %testmode eq 0 then
echos Processing ``
else
echos Testing ``
endiff
echo %filename
start /inv /belownormal %program %flacswitches %filename
else
delay /m 100
goto processfile
endiff
return
On my Ryzen 7950X Each of the %@pid calls takes about .1 seconds. I tried processmonitor, but it doesn't seem to allow me to keep track of how many processes are running
processmonitor notepad.exe started forever beep 300
processmonitor notepad.exe ended forever beep 600
The following happens:
1. Run notepad and hear the 300 HZ beep.
2. Run another notepad and hear nothing.
3. Close the second notepad and hear nothing.
4. Close the first notepad and hear the 600 HZ beep.
Any ideas would be helpful.