Cache Miss Counts from RISC V simulator

I wanted to know, how can I code my programs on risc v simulator and find the number of cache misses for that particular code? Or maybe a section of that code? I want to accomplish this using a simulator as I am not having any hardware.