Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

linux c programm time

#include <time.h>

#define CPU_TIME (getrusage(RUSAGE_SELF,&ruse), ruse.ru_utime.tv_sec + 
  ruse.ru_stime.tv_sec + 1e-6 * 
  (ruse.ru_utime.tv_usec + ruse.ru_stime.tv_usec))

int main(void) {
    time_t start, end;
    double first, second;

    // Save user and CPU start time
    time(&start);
    first = CPU_TIME;

    // Perform operations
    ...

    // Save end time
    time(&end);
    second = CPU_TIME;

    printf("cpu  : %.2f secs
", second - first); 
    printf("user : %d secs
", (int)(end - start));
}
Comment

PREVIOUS NEXT
Code Example
Shell :: how install hub on ubuntu 
Shell :: gnome shell extensions 
Shell :: create mysql user and database from script 
Shell :: angular reduce vendor.js size 
Shell :: why gitignore does not work 
Shell :: terminal shortcut ubuntu 
Shell :: ubuntu dot to png 
Shell :: Git command to Change the Author Information Just for the Next Commit 
Shell :: return boolean bash 
Shell :: man in linux 
Shell :: gradle test 
Shell :: debian libc-client.a). Please check your c-client installation 
Shell :: install docker debian 
Shell :: scan all udp ports nmap 
Shell :: remove empty page pdf 
Shell :: how to install Jupyter console 
Shell :: attach iam role to ec2 instance cli 
Shell :: concat strings inside array bash script 
Shell :: Malformed entry 2 in list file /etc/apt/sources.list.d/docker.list ([option] not assignment) 
Shell :: git --version git version 2.7.0 (Apple Git-66) 
Shell :: Copy a Remote File to a Local System using the scp Command 
Shell :: libpopt install ubuntu 
Shell :: brownie list saved accounts 
Shell :: linux encrypt pdf 
Shell :: install beego ubuntu 
Shell :: kubectl download 
Shell :: material-ui 
Shell :: bash ignore stderr 
Shell :: linux find partial name 
Shell :: node install specific version 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =