3 .callbackr)rr&rr'r)rr&rr _callback,szProfileHoldManager._callbackcCs tdd|jjDrtStS)Ncss|]}|jtkVqdS)N)rr).0holdrrr 5sz=ProfileHoldManager._effective_hold_profile..)anyrvaluesrr)rrrr_effective_hold_profile4sz*ProfileHoldManager._effective_hold_profilecCs\||jkrdS|jj|}|jjtjd|tjd|jtj d||j |j fdS)NProfileReleasedActiveProfileHoldsz5Releasing hold '%s': profile '%s' by application '%s') rpoprZcancelrZ send_signalproperty_changed as_dbus_arrayr"r#rr)rr&r*rrr_cancel9s    zProfileHoldManager._cancelcCstjdd|jjDddS)NcSsg|] }|jqSr)r)r)r*rrr Csz4ProfileHoldManager.as_dbus_array..za{sv}) signature)dbusArrayrr-)rrrrr3Bsz ProfileHoldManager.as_dbus_arraycCst|j}|jd7_|jjj||j||}tjd|||ft|||||j|<t j d|j |jj ||S)Nz2Adding hold '%s': profile '%s' by application '%s'r0) r r!busZwatch_name_ownerr(r"r#rrrr2r3switch_profile)rrrrcallerr&rrrraddEs zProfileHoldManager.addcCs ||jkS)N)r)rr&rrrhasOszProfileHoldManager.hascCs:|j|t|jdkr"|j}n|jj}|jj|dS)Nr)r4lenrr.r! base_profiler;)rr&Z new_profilerrrr$Rs   zProfileHoldManager.removecCsx|jD]}|j|qWdS)N)rr4)rr&rrrclearZs zProfileHoldManager.clearN) r rrrr(r.r4r3r=r>r$rArrrrr&s  rcs eZdZfddZddZddZeddZed d Zd d Z d dZ ddZ ddZ e jddddZe jddddZe jdddZe jdddZe jddd Ze jd!d"d#Ze jd$d%d&Ze jd'd(d)Ze jd*d+d,ZZS)- ControllercsJtt|j||_||_t||_tj|_ t |_ t j |_|jdS)N)superrBr_bus_tuned_interfacer_profile_holdsr r_performance_degradedr_cmd threadingZEvent _terminate load_config)rr:Ztuned_interface) __class__rrr`s  zController.__init__cCstj}tjjtr,t|jjtdkr,tj }tjjt rRt|jjt dkrRtj }||j kr|t jd|||_ tjd|dS)Nr9zPerformance degraded: %sr )r rospathexists NO_TURBO_PATHintrHZ read_filer LAP_MODE_PATHrrGr"r#rr2)rZperformance_degradedrrr_check_performance_degradedjs   z&Controller._check_performance_degradedcCs2tjx|jj|jds$|jq WtjdS)Nr9)rstartrHwaitrJrSstop)rrrrrunws zController.runcCs|jS)N)rD)rrrrr:}szController.buscCs|jS)N) _base_profile)rrrrr@szController.base_profilecCs|jjdS)N)rJset)rrrr terminateszController.terminatecCs&tt|_|jj|_|j|jjdS)N)rr_configZdefault_profilerXr;)rrrrrKs  zController.load_configcCsF|j|krdS|jj|}tjd||jj|tjd|dS)NzSwitching to profile '%s' ActiveProfile) active_profiler[ ppd_to_tunedr"r#rEr;rr2)rr tuned_profilerrrr;s    zController.switch_profilecCs|jj}|jjj|dS)Nunknown)rEr]r[Z tuned_to_ppdget)rr_rrrr]s zController.active_profileZsssucCs6|tkr$|tkr$tjjdttf|jj||||S)Nz'Only '%s' and '%s' profiles may be held)rrr7 exceptions DBusExceptionrFr=)rrrrr<rrr HoldProfileszController.HoldProfiler cCs,|jj|stjjd||jj|dS)NzNo active hold for cookie '%s')rFr>r7rcrdr$)rr&r<rrrReleaseProfiles zController.ReleaseProfilecCsdS)Nr)rr&rrrr/szController.ProfileReleasedr\cCs:||jjkrtjjd|||_|jj|j|dS)NzInvalid profile '%s') r[r^r7rcrdrXrFrAr;)rrrrrset_active_profiles   zController.set_active_profilecCs|jS)N)r])rrrrget_active_profileszController.get_active_profileZProfilescCs tjdd|jjjDddS)NcSsg|]}|tdqS))rZDriver)DRIVER)r)rrrrr5sz+Controller.get_profiles..za{sv})r6)r7r8r[r^keys)rrrr get_profilesszController.get_profilesZActionscCstjgddS)Ns)r6)r7r8)rrrr get_actionsszController.get_actionsr cCs|jS)N)rG)rrrrget_performance_degradedsz#Controller.get_performance_degradedr0cCs |jjS)N)rFr3)rrrrget_active_profile_holdssz#Controller.get_active_profile_holds)r rrrrSrWpropertyr:r@rZrKr;r]rZexportrerfsignalr/Zproperty_setterrgZproperty_getterrhrkrmrnro __classcell__rr)rLrrB_s$    rB)r rrZtuned.utils.commandsrZ tuned.constsrZtuned.ppd.configrrrenumr rIr7rMrar"rirPrRr objectrrZ interfacesZExportableInterfacerBrrrrs   9