resourced

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package resourced contains utilities for communicating with the Resource Manager daemon (resourced).

Index

Constants

View Source
const (

	// GameModeOff means no component managed by Resource Manager is in game
	// mode.
	GameModeOff = 0
	// GameModeBorealis means borealis is in game mode.
	GameModeBorealis = 1

	// ChromePressureLevelNone means no reduction of memory in chrome is needed.
	ChromePressureLevelNone = 0
	// ChromePressureLevelModerate means Chrome is advised to free buffers that
	// are cheap to re-allocate and are not immediately needed.
	ChromePressureLevelModerate = 1
	// ChromePressureLevelCritical means Chrome is advised to free all possible
	// memory.
	ChromePressureLevelCritical = 2

	// RTCAudioActiveOff means RTCAudioActive is off.
	RTCAudioActiveOff uint8 = 0
	// RTCAudioActiveOn means RTCAudioActive is on.
	RTCAudioActiveOn uint8 = 1

	// FullscreenVideoInactive means full screen video is not active.
	FullscreenVideoInactive uint8 = 0
	// FullscreenVideoActive means full screen video is active.
	FullscreenVideoActive uint8 = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChromePressureSignal

type ChromePressureSignal struct {
	Level uint8
	Delta uint64
}

ChromePressureSignal holds values created from the MemoryPressureChrome D-Bus signal.

type ChromePressureWatcher

type ChromePressureWatcher struct {
	Signals chan ChromePressureSignal
	// contains filtered or unexported fields
}

ChromePressureWatcher converts the MemoryPressureChrome D-Bus signal to a channel of ChromePressureSignal.

func (*ChromePressureWatcher) Close

func (pw *ChromePressureWatcher) Close(ctx context.Context) error

Close stops the MemoryPressureChrome D-Bus signal, and closes Signals, the channel of ChromePressureSignal.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps D-Bus calls to make requests to the Resource Manager (resourced).

func NewClient

func NewClient(ctx context.Context) (*Client, error)

NewClient makes a new D-Bus wrapper object for communicating with Resource Manager.

func (*Client) AvailableMemoryKB

func (c *Client) AvailableMemoryKB(ctx context.Context) (uint64, error)

AvailableMemoryKB returns the result of the GetAvailableMemoryKB D-Bus method.

func (*Client) ForegroundAvailableMemoryKB

func (c *Client) ForegroundAvailableMemoryKB(ctx context.Context) (uint64, error)

ForegroundAvailableMemoryKB returns the result of the GetForegroundAvailableMemoryKB D-Bus method.

func (*Client) FullscreenVideo

func (c *Client) FullscreenVideo(ctx context.Context) (uint8, error)

FullscreenVideo returns the result of the GetFullscreenVideo D-Bus method.

func (*Client) GameMode

func (c *Client) GameMode(ctx context.Context) (uint8, error)

GameMode returns the result of the GetGameMode D-Bus method.

func (*Client) MemoryMarginsKB

func (c *Client) MemoryMarginsKB(ctx context.Context) (Margins, error)

MemoryMarginsKB returns the result of the GetMemoryMarginsKB D-Bus method.

func (*Client) NewChromePressureWatcher

func (c *Client) NewChromePressureWatcher(ctx context.Context) (*ChromePressureWatcher, error)

NewChromePressureWatcher starts listening for MemoryPressureChrome D-Bus signals. Call ChromePressureWatcher.Close when finished.

func (*Client) RTCAudioActive

func (c *Client) RTCAudioActive(ctx context.Context) (uint8, error)

RTCAudioActive returns the result of the GetRTCAudioActive D-Bus method.

func (*Client) SetFullscreenVideoWithTimeout

func (c *Client) SetFullscreenVideoWithTimeout(ctx context.Context, fullscreenVideo uint8, timeout uint32) error

SetFullscreenVideoWithTimeout sets the full screen video state in resourced, the state will be reset after timeout seconds.

func (*Client) SetGameMode

func (c *Client) SetGameMode(ctx context.Context, mode uint8) error

SetGameMode sets the game mode state in resourced.

func (*Client) SetGameModeWithTimeout

func (c *Client) SetGameModeWithTimeout(ctx context.Context, mode uint8, timeout uint32) error

SetGameModeWithTimeout sets the game mode state in resourced, the game mode will be reset after timeout seconds.

func (*Client) SetRTCAudioActive

func (c *Client) SetRTCAudioActive(ctx context.Context, mode uint8) error

SetRTCAudioActive sets the RTC audio active state in resourced.

type Margins

type Margins struct {
	ModerateKB, CriticalKB uint64
}

Margins holds the memory margins returned from Resource Manager.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL