[PATCH] glretrace: Add a new --stub-fs to stub out fragment shaders

Carl Worth cworth at cworth.org
Mon Aug 6 14:33:22 PDT 2012


Carl Worth <cworth at cworth.org> writes:
>  Next I'll write the script to make two runs with and without
>  --stub-fs, then combine the results, do the subtraction, and print a
>  sorted list of individual fragment and vertex shaders.

I've now written this script and pushed the result to:

	git://cworth.org/git/apitrace

It uses the --stub-fs option described earlier, (and which we can likely
still improve). But this script should work more-or-less as-is with an
improved mechanism for separating VS and FS times.

See below for example output when running the script. Note that it now
accepts a trace file, (unlike the former script which accepted the
output of running glretrace), so that it can replay that trace file
multiple times.

The shader column reports shader program ID values, (those passed to
glUseProgram), but distinguishes time accounted to the VS or FS stages.

The negative values in this example output are obviously bogus. Those
give some indication of how much noise must be present in the measuring
technique here. (A negative value means that a run of the original trace
file spent less time in a particular shader program than was spent in
the same shader program in the second run with a stubbed out fragment
shader.)

Let me know if you find this useful or if you'd like to see any
improvements.

-Carl

$ ./scripts/profileshader.py bit.trip.runner.trace
Replaying original trace to measure total shader program time.
Replaying again with stub fragment shaders (expect incorrect output).
Computing times of shader program components.
Warning: Ignoring suspiciously large value of 1.66663e+16
...
Warning: Ignoring suspiciously large value of 2.81086e+15
+------------+--------------------+--------------+--------------+
| Shader[id] |   Duration [us]  v |   Draws [#]  | Per Call[us] |
+------------+--------------------+--------------+--------------+
|      42.fs |         3070651.92 |       261859 |        11.73 |
|      36.fs |         2643108.64 |      1568677 |         1.68 |
|       6.vs |         2203358.48 |       782076 |         2.82 |
|       9.vs |         1294251.34 |      1106344 |         1.17 |
|      24.fs |          954104.64 |        68365 |        13.96 |
|      42.vs |          811022.88 |       261859 |         3.10 |
|      36.vs |          682840.64 |      1568677 |         0.44 |
|      18.fs |          319684.00 |       145592 |         2.20 |
|      24.vs |          251191.04 |        68365 |         3.67 |
|      48.vs |          215635.68 |       343462 |         0.63 |
|      66.fs |           94766.48 |         8826 |        10.74 |
|      48.fs |           83174.80 |       343462 |         0.24 |
|      12.vs |           75542.32 |       322377 |         0.23 |
|      18.vs |           72436.24 |       145592 |         0.50 |
|      30.vs |           44365.68 |        16036 |         2.77 |
|       9.fs |           43985.12 |      1106344 |         0.04 |
|      60.fs |           24559.36 |        18758 |         1.31 |
|      66.vs |           22649.92 |         8826 |         2.57 |
|      12.fs |            8384.80 |       322377 |         0.03 |
|       0.vs |            6946.00 |          197 |        35.26 |
|      60.vs |            5827.92 |        18758 |         0.31 |
|      30.fs |            5094.56 |        16036 |         0.32 |
|      72.vs |            3588.40 |         2069 |         1.73 |
|      72.fs |             415.20 |         2069 |         0.20 |
|       0.fs |           -1068.40 |          197 |        -5.42 |
|       6.fs |          -19504.32 |       782076 |        -0.02 |
+------------+--------------------+--------------+--------------+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/apitrace/attachments/20120806/5f1fe527/attachment.pgp>


More information about the apitrace mailing list