Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0508ebf9 authored by Mark Salyzyn's avatar Mark Salyzyn Committed by android-build-merger
Browse files

Merge changes I92cac83b,Ie897c40b am: 4278f711

am: 898c8a6e

Change-Id: Ib01922352369bc57d4fd9f0395008d49b6d82dba
parents 82bcc7b0 898c8a6e
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -57,9 +57,19 @@ void FlushCommand::runSocketCommand(SocketClient* client) {
        entry = (*it);
        entry = (*it);
        if (entry->mClient == client) {
        if (entry->mClient == client) {
            if (entry->mTimeout.tv_sec || entry->mTimeout.tv_nsec) {
            if (entry->mTimeout.tv_sec || entry->mTimeout.tv_nsec) {
                if (mReader.logbuf().isMonotonic()) {
                    LogTimeEntry::unlock();
                    LogTimeEntry::unlock();
                    return;
                    return;
                }
                }
                // If the user changes the time in a gross manner that
                // invalidates the timeout, fall through and trigger.
                log_time now(CLOCK_REALTIME);
                if (((entry->mEnd + entry->mTimeout) > now) &&
                    (now > entry->mEnd)) {
                    LogTimeEntry::unlock();
                    return;
                }
            }
            entry->triggerReader_Locked();
            entry->triggerReader_Locked();
            if (entry->runningReader_Locked()) {
            if (entry->runningReader_Locked()) {
                LogTimeEntry::unlock();
                LogTimeEntry::unlock();
+7 −1
Original line number Original line Diff line number Diff line
@@ -370,13 +370,19 @@ int LogBuffer::log(log_id_t log_id, log_time realtime, uid_t uid, pid_t pid,


// assumes mLogElementsLock held, owns elem, will look after garbage collection
// assumes mLogElementsLock held, owns elem, will look after garbage collection
void LogBuffer::log(LogBufferElement* elem) {
void LogBuffer::log(LogBufferElement* elem) {
    // cap on how far back we will sort in-place, otherwise append
    static uint32_t too_far_back = 5;  // five seconds
    // Insert elements in time sorted order if possible
    // Insert elements in time sorted order if possible
    //  NB: if end is region locked, place element at end of list
    //  NB: if end is region locked, place element at end of list
    LogBufferElementCollection::iterator it = mLogElements.end();
    LogBufferElementCollection::iterator it = mLogElements.end();
    LogBufferElementCollection::iterator last = it;
    LogBufferElementCollection::iterator last = it;
    if (__predict_true(it != mLogElements.begin())) --it;
    if (__predict_true(it != mLogElements.begin())) --it;
    if (__predict_false(it == mLogElements.begin()) ||
    if (__predict_false(it == mLogElements.begin()) ||
        __predict_true((*it)->getRealTime() <= elem->getRealTime())) {
        __predict_true((*it)->getRealTime() <= elem->getRealTime()) ||
        __predict_false((((*it)->getRealTime().tv_sec - too_far_back) >
                         elem->getRealTime().tv_sec) &&
                        (elem->getLogId() != LOG_ID_KERNEL) &&
                        ((*it)->getLogId() != LOG_ID_KERNEL))) {
        mLogElements.push_back(elem);
        mLogElements.push_back(elem);
    } else {
    } else {
        log_time end = log_time::EPOCH;
        log_time end = log_time::EPOCH;