logd: remove FlushCommand
This code has evolved to the point that it LogReader::notifyNewLog() executes FlushCommand on every socket. FlushCommand then iterates over all log reader threads in LogTimes and flushes triggers them to flush logs if they match the client. This can be simplified to simply looping over all of the reads in LogTimes. Code readability was the primary motivation here, but note that 64% of LogReader::notifyNewLog() was spent looping over the sockets, and an additional 78% of FlushCommand::runSocketCommand() was spent repeatedly locking and unlocking the LogTimes lock. Overall, this reduces the cost of LogReader::notifyNewLog() in LogListener::onDataAvailable() from 5.91% to 2.93%. This is the critical path for handling incoming log messages, so it's a non-trivial savings. Test: logging unit tests Test: unprivileged clients still cannot view privileged logs Change-Id: Ic7620978a6c23e5e2cb179ff0c42b7cea52fc011
Loading
Please register or sign in to comment