Task to count random pulses inside a class

Hi,
I have to make a task inside scoreboard class that act as a reference model of dut.
the task will receive the random pulses from driver as input and count the number of pulses in a certain period.
After that, compare them with the actual count values coming from monitor.
The count has to be in real format.

Please assist on how to implement such a task using systemverilog.
I am confused in different methods. Professional help is required.

In reply to OmerTariq:


``` verilog

task count_pulses(input <input signal (e.g. pulse) from monitor>)
int pulse_cnt = 0;
forever @pulse  
  pulse_cnt = pulse_cnt+1;
endtask



   This task needs to be forked outside with raise and drop objections..

In reply to OmerTariq:
can you please elaborate your question like
1.)what is form of random pulse, is it some array of bits or some event?
2.) counting in certain period means on some clk edge or on some fixed time?

In reply to juhi_p:

1: random pulses are in the form of array of bits. on/off signals at certain period.
2: count the pulses on a clk edge and store it in some variable and reset the counter