using the hardware-counter of an ESP32 in PCNT-mode to measure frequencies

Hello,

I did googling for code-examples that use the hardware-counters of an ESP32 in PCNT-mode to measure frequencies.
I'm aware of solutions like pulsein, If I understand right pulsin is a blocking function the command pulsein only finishes if pulse has "finished"

I'm aware of solutions that use interrupts to do it.
But I'm interested in using the hardware-counter to

  • set hardwarecounter to zero and take a timestamp

  • let hardware-counter count pulses that are feed into a pin

  • read out value of hardware-counter after some time make a second timestamp

and calculate frequency based on counted pulses and timedifference of the two timestamps

This would enable to not need an interrupt for just doing that and not using blocking code like pulseIn.

I googled with keywords like "ESP32" and "PCNT" but didn't find any code that is arduino-based.
So if you can suggest some other keywords or even a link to a code-example that would be very nice.

best regards

Stefan