@ESP_home: Its a pity that NMI interrupts are forbiden by IDF, anyway, I reduced priority as @ESP_Sprite suggested to level 5
@ESP_Sprite: I had call from app-main() to that "constructor" function because it wasn't called otherwise! Until I realized that gcc when finds that any function declared in some .c file isn't used (like in case when from main_app you perform just direct call to assembler function) then, for some unknown reason to me, it doesnt compile code of that constructor function and there is no call at all. Thats why I had to force that call from app_main in that old version. In this latest version I fixed that by making wrapper function in .c which calls assembler function and from main_app I call that wrapper. In that case gcc do proper compilation and that constructor function IS CALLED before main_app. Is it a bug or some kind of compiler optimization when it simply ignore whole .c file if no function is called?
@MicroControler: Now, both assembler functions are aware of CORE_ID which executes them and each core has its own memory address for upper part of its CCOUNT. No more glitches. And now even that difference in CORE clocks (probably due to slightly different power time) is visible.
Added features in this version v1.0:
1. GetClock64() is now aware of coreID which calls it. So if called by CORE0 it will get clock64 from CORE0. The same apply to CORE1
2. User can allocate for example interrupt on single (doesnt matter which) or both cores. Core which is not utilized will not have its own 64 bit counter but only 32bit (its upper part will always be 0 (if memory is initialized))
3. Even if some task runs at let's say CORE0, measurement can be performed on CORE1. Now, StartSnapshot(uint8_t core_id) internaly perform checking if it is called from the same core then it just calls GetTicker64() to take a snapshot, otherwise it perform new task creation forcing that core_id passed to that function, also it then take cares when Stop is called to do snapshot on the same core where start was called etc.
4. Changed algorithm for anulation to be completely architecture independent (it doees not depends on ticks spent in function)
5. Added example where usleep(1000000) is measured, and printed start, stop and difference ticks with upper parts of CCOUNT for both cores
CPU_ticker_v1.0.zip
Here it is:
https://uploadnow.io/f/dTSZ55Y
Again, thank you all for helping this handy tool is done.