target.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Helper functions for handling target threads/cpus
  3. *
  4. * Copyright (C) 2012, LG Electronics, Namhyung Kim <namhyung.kim@lge.com>
  5. *
  6. * Released under the GPL v2.
  7. */
  8. #include "target.h"
  9. #include "debug.h"
  10. void perf_target__validate(struct perf_target *target)
  11. {
  12. if (target->pid)
  13. target->tid = target->pid;
  14. /* CPU and PID are mutually exclusive */
  15. if (target->tid && target->cpu_list) {
  16. ui__warning("WARNING: PID switch overriding CPU\n");
  17. sleep(1);
  18. target->cpu_list = NULL;
  19. }
  20. /* UID and PID are mutually exclusive */
  21. if (target->tid && target->uid_str) {
  22. ui__warning("PID/TID switch overriding UID\n");
  23. sleep(1);
  24. target->uid_str = NULL;
  25. }
  26. /* UID and CPU are mutually exclusive */
  27. if (target->uid_str && target->cpu_list) {
  28. ui__warning("UID switch overriding CPU\n");
  29. sleep(1);
  30. target->cpu_list = NULL;
  31. }
  32. /* PID/UID and SYSTEM are mutually exclusive */
  33. if ((target->tid || target->uid_str) && target->system_wide) {
  34. ui__warning("PID/TID/UID switch overriding CPU\n");
  35. sleep(1);
  36. target->system_wide = false;
  37. }
  38. }