syscall_user.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #include <stdlib.h>
  6. #include <sys/time.h>
  7. #include "kern_util.h"
  8. #include "syscall_user.h"
  9. struct {
  10. int syscall;
  11. int pid;
  12. long result;
  13. struct timeval start;
  14. struct timeval end;
  15. } syscall_record[1024];
  16. int record_syscall_start(int syscall)
  17. {
  18. int max, index;
  19. max = sizeof(syscall_record)/sizeof(syscall_record[0]);
  20. index = next_syscall_index(max);
  21. syscall_record[index].syscall = syscall;
  22. syscall_record[index].pid = current_pid();
  23. syscall_record[index].result = 0xdeadbeef;
  24. gettimeofday(&syscall_record[index].start, NULL);
  25. return(index);
  26. }
  27. void record_syscall_end(int index, long result)
  28. {
  29. syscall_record[index].result = result;
  30. gettimeofday(&syscall_record[index].end, NULL);
  31. }
  32. /*
  33. * Overrides for Emacs so that we follow Linus's tabbing style.
  34. * Emacs will notice this stuff at the end of the file and automatically
  35. * adjust the settings for this buffer only. This must remain at the end
  36. * of the file.
  37. * ---------------------------------------------------------------------------
  38. * Local variables:
  39. * c-file-style: "linux"
  40. * End:
  41. */