mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-25 16:56:35 +00:00
overlay: Generate unique name for snapshots
Since we no longer increment the counter every frame, we need to use a timestamp instead. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
a18023f678
commit
9bebbbc49b
@ -34,6 +34,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include "overlay.h"
|
#include "overlay.h"
|
||||||
#include "chart.h"
|
#include "chart.h"
|
||||||
@ -754,6 +755,13 @@ static int get_sample_period(struct config *config)
|
|||||||
return 500000;
|
return 500000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void overlay_snapshot(struct overlay_context *ctx)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
sprintf(buf, "/tmp/overlay-snapshot-%ld.png", (long)time(NULL));
|
||||||
|
cairo_surface_write_to_png(ctx->surface, buf);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
@ -853,9 +861,7 @@ int main(int argc, char **argv)
|
|||||||
overlay_show(ctx.surface);
|
overlay_show(ctx.surface);
|
||||||
|
|
||||||
if (take_snapshot) {
|
if (take_snapshot) {
|
||||||
char buf[80];
|
overlay_snapshot(&ctx);
|
||||||
sprintf(buf, "overlay-snapshot-%d.png", i-1);
|
|
||||||
cairo_surface_write_to_png(ctx.surface, buf);
|
|
||||||
take_snapshot = 0;
|
take_snapshot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user