noise

experiments with video performance in plan9
Log | Files | Refs

util.c (345B)


      1 #include <u.h>
      2 #include <libc.h>
      3 
      4 #include <thread.h>
      5 #include <draw.h>
      6 
      7 #include "noise.h"
      8 
      9 void
     10 drawfps(Image *i)
     11 {
     12 	static vlong tnew, told, avg;
     13 	char buf[64];
     14 
     15 	told = tnew;
     16 	tnew = nsec();
     17 
     18 	avg = tnew - told;//(avg + tnew - told) / 2;
     19 
     20 	snprint(buf, 64, "%f", 1000000000.0/(double)avg);
     21 	string(screen, screen->r.min, i, ZP, font, buf);
     22 }