int
_wayland_tbm_util_show_path_parse(char * path_str, char * cwd, struct wayland_tbm_monitor_path *path);
+char *
+_wayland_tbm_util_dump_path_parse(char * path_str);
+
WL_TBM_MONITOR_PROC_STATE
_wayland_tbm_util_proc_state_parse(char * str);
_wayland_tbm_util_trace(WL_TBM_MONITOR_PROC_STATE cmd, WL_TBM_MONITOR_RES res, tbm_bufmgr bufmgr);
char *
-_wayland_tbm_dump_directory_make(void);
+_wayland_tbm_dump_directory_make(const char *path);
void
_wayland_tbm_util_set_log_level(int debug_level);
double scale = 0;
int i;
char *path = NULL;
+ char *input_path = NULL;
for (i = 1; i < argc; i++) {
+ if ((!input_path) && (input_path =_wayland_tbm_util_dump_path_parse(argv[i])))
+ continue;
if (_wayland_tbm_util_scale_parse(argv[i], &scale))
- break;
+ continue;
}
- path = _wayland_tbm_dump_directory_make();
+ path = _wayland_tbm_dump_directory_make(input_path);
_wayland_tbm_util_dump_snapshot((tbm_bufmgr)wayland_tbm_client_get_bufmgr(tbm_client), scale, path);
WL_TBM_MONITOR_SNPRINTF(reply, *len, "client(%d): snapshot dump is done. path=%s\n", getpid(), path);
+
+ if (input_path)
+ free(input_path);
+
free(path);
}
double scale = 0;
int i;
char *path = NULL;
+ char *input_path = NULL;
for (i = 1; i < r->argc; i++) {
+ if ((!input_path) && (input_path =_wayland_tbm_util_dump_path_parse(r->argv[i])))
+ continue;
if (_wayland_tbm_util_target_parse(r->argv[i], &target))
continue;
if (_wayland_tbm_util_scale_parse(r->argv[i], &scale))
_wayland_tbm_monitor_request_printf(r, "'%s' - unknown target or scale for -dump_snapshot\n", r->argv[2]);
_wayland_tbm_monitor_server_usage(r);
+
+ if (input_path)
+ free(input_path);
+
return;
}
if (target.server) {
- path = _wayland_tbm_dump_directory_make();
+ path = _wayland_tbm_dump_directory_make(input_path);
_wayland_tbm_util_dump_snapshot(r->tbm_srv->bufmgr, scale, path);
_wayland_tbm_monitor_request_printf(r, "server: snapshot dump is done. path=%s\n", path);
free(path);
}
+
+ if (input_path)
+ free(input_path);
+
_send_request_to_client_with_wait(r, &target, 1);
}
{
"dump_snapshot",
_wayland_tbm_monitor_server_dump_snapshot,
- "make dumps of all tbm_surfaces for (all | server,<pid>,... ) with scale"
+ "make dumps of all tbm_surfaces for (all | server,<pid>,... ) with scale and path"
,
- "[<target>] [<scale>]\n"
+ "[<target>] [<scale>] [path]\n"
"\t"" <target>\n"
"\t"" all - clients and server\n"
"\t"" server,<pid>,... - list of targets"
"\n"
"\t""wayland-tbm-monitor -dump_snapshot all scale=0.5\n"
"\t""wayland-tbm-monitor -dump_snapshot server,1,2 scale=0.5"
+ "\t""wayland-tbm-monitor -dump_snapshot server,1,2 scale=0.5 /tmp"
},
{
"dump_queue",
return 1;
}
+char *
+_wayland_tbm_util_dump_path_parse(char * path_str)
+{
+ char *path = NULL;
+
+ if (!path_str)
+ return NULL;
+
+ if (path_str[0] == '/') {
+ path = (char *) calloc(1, PATH_MAX * sizeof(char));
+ if (!path)
+ return NULL;
+
+ snprintf(path, WL_TBM_MONITOR_PATH_LEN, "%s", path_str);
+ return path;
+ }
+
+ return NULL;
+}
int
_wayland_tbm_util_trace(WL_TBM_MONITOR_PROC_STATE cmd, WL_TBM_MONITOR_RES res, tbm_bufmgr bufmgr)
static char *path = NULL;
if (!bDump && cmd == WL_TBM_MONITOR_PROC_STATE_ON) {
- path = _wayland_tbm_dump_directory_make();
+ path = _wayland_tbm_dump_directory_make(NULL);
if (path != NULL) {
tbm_bufmgr_debug_dump_set_scale(scale);
tbm_bufmgr_debug_queue_dump(path, 20, 1);
}
char *
-_wayland_tbm_dump_directory_make(void)
+_wayland_tbm_dump_directory_make(const char *path)
{
char *fullpath;
time_t timer;
_wayland_tbm_util_get_appname_brief(appname);
-
- snprintf(fullpath, PATH_MAX, "/tmp/tbm_dump_%s_%04d%02d%02d.%02d%02d%02d", appname, t->tm_year + 1900,
- t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
+ if (path) {
+ snprintf(fullpath, PATH_MAX, "%s/tbm_dump_%s_%04d%02d%02d.%02d%02d%02d", path, appname, t->tm_year + 1900,
+ t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
+ } else {
+ snprintf(fullpath, PATH_MAX, "/tmp/tbm_dump_%s_%04d%02d%02d.%02d%02d%02d", appname, t->tm_year + 1900,
+ t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
+ }
free(buf);