summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStuart Morgan <smorgan@mythtv.org>2012-06-25 11:09:53 (GMT)
committer Stuart Morgan <smorgan@mythtv.org>2012-06-25 11:09:53 (GMT)
commitb655d8fa28a7ae3e17572db64bb7f213901c2085 (patch)
treeab34f93c5e4657c0ba9c60b95380d32701940273
parenteaab55b84c475fada5db55b3f1d4579119dd23d4 (diff)
Move QUERY_FILETRANSFER handling to improve backend performance.
This significantly reduces the backend CPU usage for me when streaming a recording or other file to the frontend. Each time we send a command to the backend we perform a number of string comparisons to find the correct handler. In the cases where that same command is sent regularly, maybe several times a second those comparisons can stack up to result in a high CPU load. This can be avoided by moving the most frequently used commands to the top of the list thereby avoiding a couple of dozen or more comparisons each time. There may be other commands that should be moved to the top with similar benefit. (cherry picked from commit 529853d11587ebee0b77753272d6dcc1a5404a11)
-rw-r--r--mythtv/programs/mythbackend/mainserver.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/mythtv/programs/mythbackend/mainserver.cpp b/mythtv/programs/mythbackend/mainserver.cpp
index aaf0598..60a41de 100644
--- a/mythtv/programs/mythbackend/mainserver.cpp
+++ b/mythtv/programs/mythbackend/mainserver.cpp
@@ -354,7 +354,14 @@ void MainServer::ProcessRequestWork(MythSocket *sock)
pbs->UpRef();
sockListLock.unlock();
- if (command == "QUERY_RECORDINGS")
+ if (command == "QUERY_FILETRANSFER")
+ {
+ if (tokens.size() != 2)
+ VERBOSE(VB_IMPORTANT, "Bad QUERY_FILETRANSFER");
+ else
+ HandleFileTransferQuery(listline, tokens, pbs);
+ }
+ else if (command == "QUERY_RECORDINGS")
{
if (tokens.size() != 2)
VERBOSE(VB_IMPORTANT, "Bad QUERY_RECORDINGS query");
@@ -546,13 +553,6 @@ void MainServer::ProcessRequestWork(MythSocket *sock)
{
HandleGetRecorderNum(listline, pbs);
}
- else if (command == "QUERY_FILETRANSFER")
- {
- if (tokens.size() != 2)
- VERBOSE(VB_IMPORTANT, "Bad QUERY_FILETRANSFER");
- else
- HandleFileTransferQuery(listline, tokens, pbs);
- }
else if (command == "QUERY_GENPIXMAP2")
{
HandleGenPreviewPixmap(listline, pbs);