nsec.c 423 B

1234567891011121314151617181920212223242526272829
  1. #include <u.h>
  2. #include <lib9.h>
  3. int verbose = 0;
  4. void
  5. main(void)
  6. {
  7. int ret = 0; // success
  8. uint64_t start, end;
  9. char *msg;
  10. start = nsec();
  11. sleep(1);
  12. end = nsec();
  13. if (end <= start)
  14. ret = 1;
  15. if (verbose)
  16. print("nsec: start %llx, end %llx\n", start, end);
  17. if(ret){
  18. msg = smprint("nsec: FAIL: start %llx end %llx",
  19. start, end);
  20. print("%s\n", msg);
  21. exits(msg);
  22. }
  23. print("PASS\n");
  24. exits("PASS");
  25. }