Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
PK!CEjppd.confnu[[main] # The default PPD profile default=balanced [profiles] # PPD = TuneD power-saver=powersave balanced=balanced performance=throughput-performance PK!;>,,tuned-ppd.servicenu[[Unit] Description=PPD-to-TuneD API Translation Daemon Requires=tuned.service After=tuned.service Before=multi-user.target display-manager.target [Service] Type=dbus PIDFile=/run/tuned/tuned-ppd.pid BusName=net.hadess.PowerProfiles ExecStart=/usr/sbin/tuned-ppd [Install] WantedBy=graphical.target PK!&^iituned-ppd.dbus.servicenu[[D-BUS Service] Name=net.hadess.PowerProfiles Exec=/bin/false User=root SystemdService=tuned-ppd.service PK!7!!%__pycache__/controller.cpython-36.pycnu[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   9PK!%r  '__pycache__/config.cpython-36.opt-1.pycnu[3 +sz+PPDConfig.load_from_file..z6Invalid profile mapping in the configuration file '%s'z8Duplicate profile mapping in the configuration file '%s'cSsi|]\}}||qSr r )rkvr r r 0sz,PPDConfig.load_from_file..z:Missing power-saver profile in the configuration file '%s'z:Missing performance profile in the configuration file '%s'z6Missing default profile in the configuration file '%s'zUnknown default profile '%s')rospathisfilerreadrPROFILES_SECTIONdictrallvalueslensetitemsrPPD_POWER_SAVERPPD_PERFORMANCE MAIN_SECTIONDEFAULT_PROFILE_OPTIONr)r r Zcfgr r r rs0          zPPDConfig.load_from_fileN) __name__ __module__ __qualname__r propertyrrrrr r r r r s    r) Ztuned.utils.config_parserrrZtuned.exceptionsrrr&r'r(rr)rr r r r s PK!%r  !__pycache__/config.cpython-36.pycnu[3 +sz+PPDConfig.load_from_file..z6Invalid profile mapping in the configuration file '%s'z8Duplicate profile mapping in the configuration file '%s'cSsi|]\}}||qSr r )rkvr r r 0sz,PPDConfig.load_from_file..z:Missing power-saver profile in the configuration file '%s'z:Missing performance profile in the configuration file '%s'z6Missing default profile in the configuration file '%s'zUnknown default profile '%s')rospathisfilerreadrPROFILES_SECTIONdictrallvalueslensetitemsrPPD_POWER_SAVERPPD_PERFORMANCE MAIN_SECTIONDEFAULT_PROFILE_OPTIONr)r r Zcfgr r r rs0          zPPDConfig.load_from_fileN) __name__ __module__ __qualname__r propertyrrrrr r r r r s    r) Ztuned.utils.config_parserrrZtuned.exceptionsrrr&r'r(rr)rr r r r s PK!7!!+__pycache__/controller.cpython-36.opt-1.pycnu[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   9PK!tuned-ppd.policynu[ TuneD https://tuned-project.org/ Hold power profile Authentication is required to hold power profiles. no no yes Release power profile Authentication is required to release power profiles. no no yes PK!+VQ Q config.pynu[from tuned.utils.config_parser import ConfigParser, Error from tuned.exceptions import TunedException import os PPD_POWER_SAVER = "power-saver" PPD_PERFORMANCE = "performance" MAIN_SECTION = "main" PROFILES_SECTION = "profiles" DEFAULT_PROFILE_OPTION = "default" class PPDConfig: def __init__(self, config_file): self.load_from_file(config_file) @property def default_profile(self): return self._default_profile @property def ppd_to_tuned(self): return self._ppd_to_tuned @property def tuned_to_ppd(self): return self._tuned_to_ppd def load_from_file(self, config_file): cfg = ConfigParser() if not os.path.isfile(config_file): raise TunedException("Configuration file '%s' does not exist" % config_file) try: cfg.read(config_file) except Error: raise TunedException("Error parsing the configuration file '%s'" % config_file) if PROFILES_SECTION not in cfg: raise TunedException("Missing profiles section in the configuration file '%s'" % config_file) self._ppd_to_tuned = dict(cfg[PROFILES_SECTION]) if not all(isinstance(mapped_profile, str) for mapped_profile in self._ppd_to_tuned.values()): raise TunedException("Invalid profile mapping in the configuration file '%s'" % config_file) if len(set(self._ppd_to_tuned.values())) != len(self._ppd_to_tuned): raise TunedException("Duplicate profile mapping in the configuration file '%s'" % config_file) self._tuned_to_ppd = {v: k for k, v in self._ppd_to_tuned.items()} if PPD_POWER_SAVER not in self._ppd_to_tuned: raise TunedException("Missing power-saver profile in the configuration file '%s'" % config_file) if PPD_PERFORMANCE not in self._ppd_to_tuned: raise TunedException("Missing performance profile in the configuration file '%s'" % config_file) if MAIN_SECTION not in cfg or DEFAULT_PROFILE_OPTION not in cfg[MAIN_SECTION]: raise TunedException("Missing default profile in the configuration file '%s'" % config_file) self._default_profile = cfg[MAIN_SECTION][DEFAULT_PROFILE_OPTION] if self._default_profile not in self._ppd_to_tuned: raise TunedException("Unknown default profile '%s'" % self._default_profile) PK!8 controller.pynu[from tuned import exports, logs from tuned.utils.commands import commands from tuned.consts import PPD_CONFIG_FILE from tuned.ppd.config import PPDConfig, PPD_PERFORMANCE, PPD_POWER_SAVER from enum import StrEnum import threading import dbus import os log = logs.get() DRIVER = "tuned" NO_TURBO_PATH = "/sys/devices/system/cpu/intel_pstate/no_turbo" LAP_MODE_PATH = "/sys/bus/platform/devices/thinkpad_acpi/dytc_lapmode" class PerformanceDegraded(StrEnum): NONE = "" LAP_DETECTED = "lap-detected" HIGH_OPERATING_TEMPERATURE = "high-operating-temperature" class ProfileHold(object): def __init__(self, profile, reason, app_id, watch): self.profile = profile self.reason = reason self.app_id = app_id self.watch = watch def as_dict(self): return { "Profile": self.profile, "Reason": self.reason, "ApplicationId": self.app_id, } class ProfileHoldManager(object): def __init__(self, controller): self._holds = {} self._cookie_counter = 0 self._controller = controller def _callback(self, cookie, app_id): def callback(name): if name == "": log.info("Application '%s' disappeared, releasing hold '%s'" % (app_id, cookie)) self.remove(cookie) return callback def _effective_hold_profile(self): if any(hold.profile == PPD_POWER_SAVER for hold in self._holds.values()): return PPD_POWER_SAVER return PPD_PERFORMANCE def _cancel(self, cookie): if cookie not in self._holds: return hold = self._holds.pop(cookie) hold.watch.cancel() exports.send_signal("ProfileReleased", cookie) exports.property_changed("ActiveProfileHolds", self.as_dbus_array()) log.info("Releasing hold '%s': profile '%s' by application '%s'" % (cookie, hold.profile, hold.app_id)) def as_dbus_array(self): return dbus.Array([hold.as_dict() for hold in self._holds.values()], signature="a{sv}") def add(self, profile, reason, app_id, caller): cookie = self._cookie_counter self._cookie_counter += 1 watch = self._controller.bus.watch_name_owner(caller, self._callback(cookie, app_id)) log.info("Adding hold '%s': profile '%s' by application '%s'" % (cookie, profile, app_id)) self._holds[cookie] = ProfileHold(profile, reason, app_id, watch) exports.property_changed("ActiveProfileHolds", self.as_dbus_array()) self._controller.switch_profile(profile) return cookie def has(self, cookie): return cookie in self._holds def remove(self, cookie): self._cancel(cookie) if len(self._holds) != 0: new_profile = self._effective_hold_profile() else: new_profile = self._controller.base_profile self._controller.switch_profile(new_profile) def clear(self): for cookie in self._holds: self._cancel(cookie) class Controller(exports.interfaces.ExportableInterface): def __init__(self, bus, tuned_interface): super(Controller, self).__init__() self._bus = bus self._tuned_interface = tuned_interface self._profile_holds = ProfileHoldManager(self) self._performance_degraded = PerformanceDegraded.NONE self._cmd = commands() self._terminate = threading.Event() self.load_config() def _check_performance_degraded(self): performance_degraded = PerformanceDegraded.NONE if os.path.exists(NO_TURBO_PATH): if int(self._cmd.read_file(NO_TURBO_PATH)) == 1: performance_degraded = PerformanceDegraded.HIGH_OPERATING_TEMPERATURE if os.path.exists(LAP_MODE_PATH): if int(self._cmd.read_file(LAP_MODE_PATH)) == 1: performance_degraded = PerformanceDegraded.LAP_DETECTED if performance_degraded != self._performance_degraded: log.info("Performance degraded: %s" % performance_degraded) self._performance_degraded = performance_degraded exports.property_changed("PerformanceDegraded", performance_degraded) def run(self): exports.start() while not self._cmd.wait(self._terminate, 1): self._check_performance_degraded() exports.stop() @property def bus(self): return self._bus @property def base_profile(self): return self._base_profile def terminate(self): self._terminate.set() def load_config(self): self._config = PPDConfig(PPD_CONFIG_FILE) self._base_profile = self._config.default_profile self.switch_profile(self._config.default_profile) def switch_profile(self, profile): if self.active_profile() == profile: return tuned_profile = self._config.ppd_to_tuned[profile] log.info("Switching to profile '%s'" % tuned_profile) self._tuned_interface.switch_profile(tuned_profile) exports.property_changed("ActiveProfile", profile) def active_profile(self): tuned_profile = self._tuned_interface.active_profile() return self._config.tuned_to_ppd.get(tuned_profile, "unknown") @exports.export("sss", "u") def HoldProfile(self, profile, reason, app_id, caller): if profile != PPD_POWER_SAVER and profile != PPD_PERFORMANCE: raise dbus.exceptions.DBusException( "Only '%s' and '%s' profiles may be held" % (PPD_POWER_SAVER, PPD_PERFORMANCE) ) return self._profile_holds.add(profile, reason, app_id, caller) @exports.export("u", "") def ReleaseProfile(self, cookie, caller): if not self._profile_holds.has(cookie): raise dbus.exceptions.DBusException("No active hold for cookie '%s'" % cookie) self._profile_holds.remove(cookie) @exports.signal("u") def ProfileReleased(self, cookie): pass @exports.property_setter("ActiveProfile") def set_active_profile(self, profile): if profile not in self._config.ppd_to_tuned: raise dbus.exceptions.DBusException("Invalid profile '%s'" % profile) self._base_profile = profile self._profile_holds.clear() self.switch_profile(profile) @exports.property_getter("ActiveProfile") def get_active_profile(self): return self.active_profile() @exports.property_getter("Profiles") def get_profiles(self): return dbus.Array( [{"Profile": profile, "Driver": DRIVER} for profile in self._config.ppd_to_tuned.keys()], signature="a{sv}", ) @exports.property_getter("Actions") def get_actions(self): return dbus.Array([], signature="s") @exports.property_getter("PerformanceDegraded") def get_performance_degraded(self): return self._performance_degraded @exports.property_getter("ActiveProfileHolds") def get_active_profile_holds(self): return self._profile_holds.as_dbus_array() PK!"za dbus.confnu[ PK!CEjppd.confnu[PK!;>,,tuned-ppd.servicenu[PK!&^ii<tuned-ppd.dbus.servicenu[PK!7!!%__pycache__/controller.cpython-36.pycnu[PK!%r  '4%__pycache__/config.cpython-36.opt-1.pycnu[PK!%r  !/__pycache__/config.cpython-36.pycnu[PK!7!!+:__pycache__/controller.cpython-36.opt-1.pycnu[PK!c\tuned-ppd.policynu[PK!+VQ Q `config.pynu[PK!8  jcontroller.pynu[PK!"za dbus.confnu[PK ,