mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-15 12:03:41 +00:00
perf
This commit is contained in:
@@ -257,7 +257,7 @@ static void *_capture_worker_thread(void *v_ctx_ptr) {
|
|||||||
*ctx->last_comp_time = last_comp_time;
|
*ctx->last_comp_time = last_comp_time;
|
||||||
A_PTHREAD_M_UNLOCK(ctx->last_comp_time_mutex);
|
A_PTHREAD_M_UNLOCK(ctx->last_comp_time_mutex);
|
||||||
|
|
||||||
LOG_INFO("Compressed JPEG size=%ld; time=%LG (worker %d)", compressed, last_comp_time, ctx->index); // FIXME
|
LOG_PERF("Compressed JPEG size=%ld; time=%LG (worker %d)", compressed, last_comp_time, ctx->index); // FIXME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ static const struct option _long_opts[] = {
|
|||||||
{"v4l2-timeout", required_argument, NULL, 1002},
|
{"v4l2-timeout", required_argument, NULL, 1002},
|
||||||
{"v4l2-error-timeout", required_argument, NULL, 1003},
|
{"v4l2-error-timeout", required_argument, NULL, 1003},
|
||||||
{"debug", no_argument, NULL, 5000},
|
{"debug", no_argument, NULL, 5000},
|
||||||
|
{"perf", no_argument, NULL, 5001},
|
||||||
{NULL, 0, NULL, 0},
|
{NULL, 0, NULL, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,7 +63,8 @@ static void _parse_options(int argc, char *argv[], struct device_t *dev) {
|
|||||||
int index;
|
int index;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
debug = false;
|
log_debug = false;
|
||||||
|
log_perf = false;
|
||||||
while ((ch = getopt_long(argc, argv, _short_opts, _long_opts, &index)) >= 0) {
|
while ((ch = getopt_long(argc, argv, _short_opts, _long_opts, &index)) >= 0) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 0: break;
|
case 0: break;
|
||||||
@@ -81,7 +83,8 @@ static void _parse_options(int argc, char *argv[], struct device_t *dev) {
|
|||||||
case 1001: OPT_UNSIGNED(dev->height, "--height", 180);
|
case 1001: OPT_UNSIGNED(dev->height, "--height", 180);
|
||||||
case 1002: OPT_UNSIGNED(dev->timeout, "--timeout", 1);
|
case 1002: OPT_UNSIGNED(dev->timeout, "--timeout", 1);
|
||||||
case 1003: OPT_UNSIGNED(dev->error_timeout, "--error-timeout", 1);
|
case 1003: OPT_UNSIGNED(dev->error_timeout, "--error-timeout", 1);
|
||||||
case 5000: OPT_TRUE(debug);
|
case 5000: OPT_TRUE(log_debug);
|
||||||
|
case 5001: OPT_TRUE(log_perf);
|
||||||
case 'h': _help(EXIT_SUCCESS); break;
|
case 'h': _help(EXIT_SUCCESS); break;
|
||||||
default: _help(EXIT_FAILURE); break;
|
default: _help(EXIT_FAILURE); break;
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/tools.h
11
src/tools.h
@@ -15,7 +15,8 @@
|
|||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
|
|
||||||
bool debug;
|
bool log_debug;
|
||||||
|
bool log_perf;
|
||||||
|
|
||||||
|
|
||||||
#define SEP_INFO(_x_ch) \
|
#define SEP_INFO(_x_ch) \
|
||||||
@@ -33,11 +34,15 @@ bool debug;
|
|||||||
printf("-- INFO " INNER_LOG_PL " -- " _x_msg "\n", INNER_LOG_PARAMS, ##__VA_ARGS__); }
|
printf("-- INFO " INNER_LOG_PL " -- " _x_msg "\n", INNER_LOG_PARAMS, ##__VA_ARGS__); }
|
||||||
|
|
||||||
#define LOG_DEBUG(_x_msg, ...) \
|
#define LOG_DEBUG(_x_msg, ...) \
|
||||||
{ if (debug) { INNER_LOG_MK_PARAMS; \
|
{ if (log_debug) { INNER_LOG_MK_PARAMS; \
|
||||||
printf("-- DEBUG " INNER_LOG_PL " -- " _x_msg "\n", INNER_LOG_PARAMS, ##__VA_ARGS__); } }
|
printf("-- DEBUG " INNER_LOG_PL " -- " _x_msg "\n", INNER_LOG_PARAMS, ##__VA_ARGS__); } }
|
||||||
|
|
||||||
|
#define LOG_PERF(_x_msg, ...) \
|
||||||
|
{ if (log_debug || log_perf) { INNER_LOG_MK_PARAMS; \
|
||||||
|
printf("-- PERF " INNER_LOG_PL " -- " _x_msg "\n", INNER_LOG_PARAMS, ##__VA_ARGS__); } }
|
||||||
|
|
||||||
#define SEP_DEBUG(_x_ch) \
|
#define SEP_DEBUG(_x_ch) \
|
||||||
{ if (debug) { SEP_INFO(_x_ch); } }
|
{ if (log_debug) { SEP_INFO(_x_ch); } }
|
||||||
|
|
||||||
#define LOG_ERROR(_x_msg, ...) \
|
#define LOG_ERROR(_x_msg, ...) \
|
||||||
{ INNER_LOG_MK_PARAMS; \
|
{ INNER_LOG_MK_PARAMS; \
|
||||||
|
|||||||
Reference in New Issue
Block a user