Edit

IABSD.fr/xenocara/lib/mesa/src/tool/pps/pps.cc

Branch :

  • Show log

    Commit

  • Author : jsg
    Date : 2023-11-02 04:31:01
    Hash : 60059fee
    Message : Import Mesa 23.1.9

  • lib/mesa/src/tool/pps/pps.cc
  • /*
     * Copyright © 2020 Collabora, Ltd.
     * Author: Antonio Caggiano <antonio.caggiano@collabora.com>
     *
     * SPDX-License-Identifier: MIT
     */
    
    #include "pps.h"
    
    #include <cerrno>
    #include <cstring>
    
    #include <sched.h>
    
    namespace pps
    {
    bool check(int res, const char *msg)
    {
       if (res < 0) {
          char *err_msg = std::strerror(errno);
          PERFETTO_ELOG("%s: %s", msg, err_msg);
          return false;
       }
    
       return true;
    }
    
    void make_thread_rt()
    {
       // Use FIFO policy to avoid preemption while collecting counters
       int sched_policy = SCHED_FIFO;
       // Do not use max priority to avoid starving migration and watchdog threads
       int priority_value = sched_get_priority_max(sched_policy) - 1;
       sched_param priority_param { priority_value };
       sched_setscheduler(0, sched_policy, &priority_param);
    }
    
    } // namespace pps