intel/perf: print debug information
authorMark Janes <mark.a.janes@intel.com>
Wed, 17 Jul 2019 21:36:44 +0000 (14:36 -0700)
committerMark Janes <mark.a.janes@intel.com>
Thu, 8 Aug 2019 04:33:56 +0000 (21:33 -0700)
INTEL_DEBUG=perfmon will iterate over the perf queries, printing
information about the state of each query.  Some of this information
will be private to intel/perf, and needs to a dump routine that can be
called from i965.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/perf/gen_perf.c
src/intel/perf/gen_perf.h
src/mesa/drivers/dri/i965/brw_performance_query.c

index 2d1a58bae9e1901ad55ed3a11ab03af957f2fcb3..0bac1fd2888168c27104adbb1e72e2bf271517c0 100644 (file)
@@ -2266,3 +2266,33 @@ gen_perf_get_query_data(struct gen_perf_context *perf_ctx,
    if (bytes_written)
       *bytes_written = written;
 }
+
+void
+gen_perf_dump_query_count(struct gen_perf_context *perf_ctx)
+{
+   DBG("Queries: (Open queries = %d, OA users = %d)\n",
+       perf_ctx->n_active_oa_queries, perf_ctx->n_oa_users);
+}
+
+void
+gen_perf_dump_query(struct gen_perf_context *ctx,
+                    struct gen_perf_query_object *obj,
+                    void *current_batch)
+{
+   switch (obj->queryinfo->kind) {
+   case GEN_PERF_QUERY_TYPE_OA:
+   case GEN_PERF_QUERY_TYPE_RAW:
+      DBG("BO: %-4s OA data: %-10s %-15s\n",
+          obj->oa.bo ? "yes," : "no,",
+          gen_perf_is_query_ready(ctx, obj, current_batch) ? "ready," : "not ready,",
+          obj->oa.results_accumulated ? "accumulated" : "not accumulated");
+      break;
+   case GEN_PERF_QUERY_TYPE_PIPELINE:
+      DBG("BO: %-4s\n",
+          obj->pipeline_stats.bo ? "yes" : "no");
+      break;
+   default:
+      unreachable("Unknown query type");
+      break;
+   }
+}
index 1b0836f9ff111aed23752e5fc8fbeffaa4396545..d41789007147b529387ea6166939fa94bf82f51f 100644 (file)
@@ -445,4 +445,9 @@ void gen_perf_get_query_data(struct gen_perf_context *perf_ctx,
                              unsigned *data,
                              unsigned *bytes_written);
 
+void gen_perf_dump_query_count(struct gen_perf_context *perf_ctx);
+void gen_perf_dump_query(struct gen_perf_context *perf_ctx,
+                         struct gen_perf_query_object *obj,
+                         void *current_batch);
+
 #endif /* GEN_PERF_H */
index c1cba62cb3ac72a2a2d093e1e7ce0d0453bbe0d8..80a2ba6f4b43e8ca102e3cf33fb5fe3d55729193 100644 (file)
@@ -111,41 +111,24 @@ brw_is_perf_query_ready(struct gl_context *ctx,
 static void
 dump_perf_query_callback(GLuint id, void *query_void, void *brw_void)
 {
-   struct gl_context *ctx = brw_void;
+   struct brw_context *ctx = brw_void;
+   struct gen_perf_context *perf_ctx = &ctx->perf_ctx;
    struct gl_perf_query_object *o = query_void;
    struct brw_perf_query_object * brw_query = brw_perf_query(o);
    struct gen_perf_query_object *obj = brw_query->query;
 
-   switch (obj->queryinfo->kind) {
-   case GEN_PERF_QUERY_TYPE_OA:
-   case GEN_PERF_QUERY_TYPE_RAW:
-      DBG("%4d: %-6s %-8s BO: %-4s OA data: %-10s %-15s\n",
-          id,
-          o->Used ? "Dirty," : "New,",
-          o->Active ? "Active," : (o->Ready ? "Ready," : "Pending,"),
-          obj->oa.bo ? "yes," : "no,",
-          brw_is_perf_query_ready(ctx, o) ? "ready," : "not ready,",
-          obj->oa.results_accumulated ? "accumulated" : "not accumulated");
-      break;
-   case GEN_PERF_QUERY_TYPE_PIPELINE:
-      DBG("%4d: %-6s %-8s BO: %-4s\n",
-          id,
-          o->Used ? "Dirty," : "New,",
-          o->Active ? "Active," : (o->Ready ? "Ready," : "Pending,"),
-          obj->pipeline_stats.bo ? "yes" : "no");
-      break;
-   default:
-      unreachable("Unknown query type");
-      break;
-   }
+   DBG("%4d: %-6s %-8s ",
+       id,
+       o->Used ? "Dirty," : "New,",
+       o->Active ? "Active," : (o->Ready ? "Ready," : "Pending,"));
+   gen_perf_dump_query(perf_ctx, obj, &ctx->batch);
 }
 
 static void
 dump_perf_queries(struct brw_context *brw)
 {
    struct gl_context *ctx = &brw->ctx;
-   DBG("Queries: (Open queries = %d, OA users = %d)\n",
-       brw->perf_ctx.n_active_oa_queries, brw->perf_ctx.n_oa_users);
+   gen_perf_dump_query_count(&brw->perf_ctx);
    _mesa_HashWalk(ctx->PerfQuery.Objects, dump_perf_query_callback, brw);
 }