diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/encoded_log_entry.cc | 15 | ||||
| -rw-r--r-- | src/lib/encoded_log_entry.h | 3 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/encoded_log_entry.cc b/src/lib/encoded_log_entry.cc index 9a0fe5e49..10c083eaf 100644 --- a/src/lib/encoded_log_entry.cc +++ b/src/lib/encoded_log_entry.cc @@ -21,6 +21,9 @@ #include "encoded_log_entry.h" #include <fmt/format.h> +#ifdef DCPOMATIC_LINUX +#include <pthread.h> +#endif using std::string; @@ -34,12 +37,20 @@ EncodedLogEntry::EncodedLogEntry(int frame, string ip, double receive, double en , _encode(encode) , _send(send) { - +#ifdef DCPOMATIC_LINUX + char name[16]; + pthread_getname_np(pthread_self(), name, sizeof(name)); + _thread_name = name; +#endif } string EncodedLogEntry::message() const { - return fmt::format("Encoded frame {} from {}: receive {:.2f}s encode {:.2f}s send {:.2f}s.", _frame, _ip.c_str(), _receive, _encode, _send); + string thread_info; +#ifdef DCPOMATIC_LINUX + thread_info = fmt::format(" on {}", _thread_name); +#endif + return fmt::format("Encoded frame {} from {}{}: receive {:.2f}s encode {:.2f}s send {:.2f}s.", _frame, _ip.c_str(), thread_info, _receive, _encode, _send); } diff --git a/src/lib/encoded_log_entry.h b/src/lib/encoded_log_entry.h index 38622f305..5acc84607 100644 --- a/src/lib/encoded_log_entry.h +++ b/src/lib/encoded_log_entry.h @@ -35,4 +35,7 @@ private: double _receive; double _encode; double _send; +#ifdef DCPOMATIC_LINUX + std::string _thread_name; +#endif }; |
