lima: Beautify stream dumps

Change the dump, that the output looks more like the output of
mali-syscall-tracker [1].
This is a preparation for a more detailed stream analysis.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>

[1]: https://gitlab.freedesktop.org/lima/mali-syscall-tracker
This commit is contained in:
Andreas Baierl 2019-10-17 12:21:13 +02:00 committed by Vasily Khoruzhick
parent 3b3494174d
commit c76eb7ea84
1 changed files with 11 additions and 7 deletions

View File

@ -51,18 +51,22 @@ bool lima_get_absolute_timeout(uint64_t *timeout)
void lima_dump_blob(FILE *fp, void *data, int size, bool is_float)
{
fprintf(fp, "{\n");
for (int i = 0; i * 4 < size; i++) {
if (i % 4 == 0) {
if (i) fprintf(fp, "\n");
fprintf(fp, "%04x:", i * 4);
}
if (i % 4 == 0)
fprintf(fp, "\t");
if (is_float)
fprintf(fp, " %f", ((float *)data)[i]);
fprintf(fp, "%f, ", ((float *)data)[i]);
else
fprintf(fp, " 0x%08x", ((uint32_t *)data)[i]);
fprintf(fp, "0x%08x, ", ((uint32_t *)data)[i]);
if ((i % 4 == 3) || (i == size / 4 - 1)) {
fprintf(fp, "/* 0x%08x */", (i - 3) * 4);
if (i) fprintf(fp, "\n");
}
}
fprintf(fp, "\n");
fprintf(fp, "}\n");
}
void