Quantcast
Channel: SwhistleSoft Blog » Bash Scripting
Viewing all articles
Browse latest Browse all 8

Using Perl to time Bash Calls – Bash fine grain timer

$
0
0

Using Perl to time Bash Calls – Bash fine grain timer

I was looking for a way to cross platform way to make a microsecond timer or anything less than one second for that matter in bash. Aside from doing a fork each time this function needs to be called, this is a pretty good alternative to c programming because it is quick and dirty. This function will allow us to be portable and not think too much about the implementation for the time being.

#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes qw(usleep nanosleep);
usleep(100);

Viewing all articles
Browse latest Browse all 8

Trending Articles