CPU Utilization

I have written program in Arduino IDE for automated street lighting system using IoT. My project is working fine.

Now I want to measure CPU Utilization of the same program that I have written and uploaded on Arduino. But I don't know how to do it.

Is there any tool or piece of code which can fulfill my purpose.

100%. Unless you are putting the processor to sleep.

Microcontrollers dont really have a concept of utilisation.

For instance if a microcontroller is in a loop, polling a switch and waiting for it to be pressed, its 100% utilised checking the switch.

The closest analogy I can think of ATM would be: Suppose you want an overall update rate of ~60Hz or 16.7mS. You might want to know how much of a time-slice each of your 15 functions being called during that 16.7mS period is taking to see how much margin you have.

For that sort of thing you can get an approximation by timing execution of a function by framing it with micros() and measuring the time of each function. For example:

void setup() 
{
    Serial.begin(9600);
    
}//setup

void loop() 
{
    unsigned long
        timeExecute,
        timeStart;

    timeStart = micros();
    DoSomeFunction();
    timeExecute = micros() - timeStart;

    Serial.print( "Time to execute was " );
    Serial.print( timeExecute );
    Serial.println( "uS" );

    delay(1000);
    
}//loop

void DoSomeFunction( void )
{
    float
        val;
        
    val = sin( (3.14159 * 2.0)/180.0 );
    Serial.print( "   Sin(2PI) = " );
    Serial.println( val, 3 );
    
}

You could also time the duration of a single loop (i.e. the sum of all function durations) and determine how much margin you have.

If you're using FreeRTOS or similar, there might be tools available to do the equivalent for them.