i_qdf_perf.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) 2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /**
  27. * DOC: i_qdf_perf
  28. * This file provides OS dependent perf API's.
  29. */
  30. #ifndef _I_QDF_PERF_H
  31. #define _I_QDF_PERF_H
  32. #ifdef QCA_PERF_PROFILING
  33. #if (QCA_MIPS74K_PERF_PROFILING || QCA_MIPS24KK_PERF_PROFILING)
  34. #include <qdf_mips_perf_pvt.h>
  35. #endif
  36. /* #defines required for structures */
  37. #define MAX_SAMPLES_SHIFT 5 /* change this only*/
  38. #define MAX_SAMPLES (1 << MAX_SAMPLES_SHIFT)
  39. #define INC_SAMPLES(x) ((x + 1) & (MAX_SAMPLES - 1))
  40. #define MAX_SAMPLE_SZ (sizeof(uint32_t) * MAX_SAMPLES)
  41. #define PER_SAMPLE_SZ sizeof(uint32_t)
  42. /**
  43. * typedef qdf_perf_entry_t - performance entry
  44. * @list: pointer to next
  45. * @child: pointer tochild
  46. * @parent: pointer to top
  47. * @type: perf cntr
  48. * @name: string
  49. * @proc: pointer to proc entry
  50. * @start_tsc: array at start tsc
  51. * @end_tsc: array at ent tsc
  52. * @samples: array of samples
  53. * @sample_idx: sample index
  54. * @lock_irq: lock irq
  55. */
  56. typedef struct qdf_os_perf_entry {
  57. struct list_head list;
  58. struct list_head child;
  59. struct qdf_perf_entry *parent;
  60. qdf_perf_cntr_t type;
  61. uint8_t *name;
  62. struct proc_dir_entry *proc;
  63. uint64_t start_tsc[MAX_SAMPLES];
  64. uint64_t end_tsc[MAX_SAMPLES];
  65. uint32_t samples[MAX_SAMPLES];
  66. uint32_t sample_idx;
  67. spinlock_t lock_irq;
  68. } qdf_perf_entry_t;
  69. /* typedefs */
  70. typedef void *__qdf_perf_id_t;
  71. #endif /* QCA_PERF_PROFILING */
  72. #endif /* _I_QDF_PERF_H */