recordStdin

measure time between line coming from stdin, example: ls | recordStdin | tee ls.txt
git clone https://noulin.net/git/recordStdin.git
Log | Files | Refs | LICENSE

recordStdin.c (375B)


      1 #! /usr/bin/env sheepy
      2 
      3 #include "libsheepyObject.h"
      4 
      5 int main(int ARGC, char** ARGV) {
      6 
      7     char b[2*1024*1024];
      8     u64 startTime   = getMonotonicTime();
      9     u64 currentTime = 0;
     10 
     11     while (fgets(b, sizeof b, stdin)) {
     12         currentTime = getMonotonicTime();
     13         printf("%d, %s", (int)((currentTime - startTime)/1000000),b);
     14         startTime = currentTime;
     15     }
     16 }