commit f27bc7ff17b5381be9f7fffce5f75146eb34390a
parent 44f803d2fdbca5476f0d81a331dd14856a7961fd
Author: Remy Noulin <loader2x@gmail.com>
Date: Sun, 20 May 2018 10:34:10 +0200
record stdin, play with playStdin
package.yml | 16 ++++++++++++++++
recordStdin.c | 16 ++++++++++++++++
2 files changed, 32 insertions(+)
Diffstat:
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/package.yml b/package.yml
@@ -0,0 +1,16 @@
+---
+ name: recordStdin
+ version: 0.0.1
+ description: "measure time between line coming from stdin, example: ls | recordStdin | tee ls.txt"
+ bin: ./recordStdin.c
+ repository:
+ type: git
+ url: git+https://github.com/RemyNoulin/recordStdin.git
+ keywords:
+ - utility
+ - command
+ author: Remy
+ license: MIT
+ bugs:
+ url: https://github.com/RemyNoulin/recordStdin/issues
+ homepage: https://github.com/RemyNoulin/recordStdin#readme
diff --git a/recordStdin.c b/recordStdin.c
@@ -0,0 +1,16 @@
+#! /usr/bin/env sheepy
+
+#include "libsheepyObject.h"
+
+int main(int ARGC, char** ARGV) {
+
+ char b[2*1024*1024];
+ u64 startTime = getMonotonicTime();
+ u64 currentTime = 0;
+
+ while (fgets(b, sizeof b, stdin)) {
+ currentTime = getMonotonicTime();
+ printf("%d, %s", (int)((currentTime - startTime)/1000000),b);
+ startTime = currentTime;
+ }
+}