summaryrefslogtreecommitdiffstats
path: root/src/intel/perf/gen_perf.c
diff options
context:
space:
mode:
authorMark Janes <[email protected]>2019-06-03 16:11:16 -0700
committerMark Janes <[email protected]>2019-08-07 21:33:55 -0700
commit2f712d21b9913833462031c0a3c52bcf90046e15 (patch)
tree4762b964b362ed869aa148309574d0db85c7a566 /src/intel/perf/gen_perf.c
parent31758bd36c58c59bf2e872b7844d7fd4c69144db (diff)
intel/perf: move reap_old_sample_buffers into perf
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel/perf/gen_perf.c')
-rw-r--r--src/intel/perf/gen_perf.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/intel/perf/gen_perf.c b/src/intel/perf/gen_perf.c
index 131fe34abe3..9df94512dc6 100644
--- a/src/intel/perf/gen_perf.c
+++ b/src/intel/perf/gen_perf.c
@@ -843,3 +843,27 @@ gen_perf_get_free_sample_buf(struct gen_perf_context *perf_ctx)
return buf;
}
+
+void
+gen_perf_reap_old_sample_buffers(struct gen_perf_context *perf_ctx)
+{
+ struct exec_node *tail_node =
+ exec_list_get_tail(&perf_ctx->sample_buffers);
+ struct oa_sample_buf *tail_buf =
+ exec_node_data(struct oa_sample_buf, tail_node, link);
+
+ /* Remove all old, unreferenced sample buffers walking forward from
+ * the head of the list, except always leave at least one node in
+ * the list so we always have a node to reference when we Begin
+ * a new query.
+ */
+ foreach_list_typed_safe(struct oa_sample_buf, buf, link,
+ &perf_ctx->sample_buffers)
+ {
+ if (buf->refcount == 0 && buf != tail_buf) {
+ exec_node_remove(&buf->link);
+ exec_list_push_head(&perf_ctx->free_sample_buffers, &buf->link);
+ } else
+ return;
+ }
+}