Sistem

paket "sistem";

The sistem package contains a couple of utility system functions. These include:

  1. tempiraj
  2. tempirajNano
  3. zatvoriProces

tempiraj

The tempiraj function is used to measure the execution time of a provided function in milliseconds.

var vrijeme = tempiraj(funkcija(){
    za svako (x od 1 do 1_000_000){
        x^2;
    }
});

ispis("Execution time: ", vrijeme, "ms");
Output:

Execution time: 489ms

Note that the lambda function you pass as the argument should not take any arguments itself, nor return anything.

tempirajNano

The tempirajNano function is used to measure the execution time of a provided function in nanoseconds.

paket "sistem";

var vrijeme = tempirajNano(funkcija(){
    za svako (x od 1 do 1_000_000){
        x^2;
    }
});

ispis("Execution time: ", vrijeme, " nanoseconds");
Output:

Execution time: 2.979184E8 nanoseconds

The function behaves exactly the same as tempiraj, except for the unit of time it returns.

zatvoriProces

The zatvoriProces function terminates the currently running process with a provided status.

zatvoriProces(0);

Process finished with exit code 0
zatvoriProces(-1);

Process finished with exit code -1

By convention, any non-zero exit code indicates an abnormal termination.