Documentation
¶
Index ¶
- Constants
- Variables
- func ApplySchedulingStrategy(task *models.QueuedTask) bool
- func GetPoolCount() int
- func GetSchedulerConfig() (uint64, uint64)
- func GetTaskExecutionTime(pid int32) uint64
- func GetTaskFromPool() *models.QueuedTask
- func InsertTaskToPool(newTask Task) bool
- func LessQueuedTask(a, b *Task) bool
- func SetSchedulerConfig(sliceNsDefault, sliceNsMin uint64)
- func StartStrategyFetcher(ctx context.Context, apiUrl string, interval time.Duration)
- func UpdateStrategyMap(strategies []SchedulingStrategy)
- type BssData
- type ErrorResponse
- type GthulhuPlugin
- func (g *GthulhuPlugin) DetermineTimeSlice(s plugin.Sched, t *models.QueuedTask) uint64
- func (g *GthulhuPlugin) DrainQueuedTask(s plugin.Sched) int
- func (g *GthulhuPlugin) GetPoolCount() uint64
- func (g *GthulhuPlugin) SelectCPU(s plugin.Sched, t *models.QueuedTask) (error, int32)
- func (g *GthulhuPlugin) SelectQueuedTask(s plugin.Sched) *models.QueuedTask
- type JWTClient
- type MetricsClient
- type MetricsResponse
- type SchedulingStrategiesResponse
- type SchedulingStrategy
- type Task
- type TokenRequest
- type TokenResponse
Constants ¶
const ( MAX_LATENCY_WEIGHT = 1000 SCX_ENQ_WAKEUP = 1 NSEC_PER_SEC = 1000000000 // 1 second in nanoseconds PF_WQ_WORKER = 0x00000020 )
const SCX_ENQ_PREEMPT = 1 << 32
Variables ¶
var ( SLICE_NS_DEFAULT uint64 = 5000 * 1000 // 5ms (default) SLICE_NS_MIN uint64 = 500 * 1000 // 0.5ms (default) )
Configurable scheduler parameters
Functions ¶
func ApplySchedulingStrategy ¶
func ApplySchedulingStrategy(task *models.QueuedTask) bool
ApplySchedulingStrategy applies scheduling strategies to a task
func GetPoolCount ¶
func GetPoolCount() int
func GetSchedulerConfig ¶
GetSchedulerConfig returns current scheduler configuration
func GetTaskExecutionTime ¶
GetTaskExecutionTime returns the custom execution time for a task if defined
func GetTaskFromPool ¶
func GetTaskFromPool() *models.QueuedTask
func InsertTaskToPool ¶
func LessQueuedTask ¶
func SetSchedulerConfig ¶
func SetSchedulerConfig(sliceNsDefault, sliceNsMin uint64)
SetSchedulerConfig updates the scheduler parameters from configuration
func StartStrategyFetcher ¶
StartStrategyFetcher starts a background goroutine to periodically fetch scheduling strategies
func UpdateStrategyMap ¶
func UpdateStrategyMap(strategies []SchedulingStrategy)
UpdateStrategyMap updates the strategy map from a slice of strategies
Types ¶
type BssData ¶
type BssData struct {
UserschedLastRunAt uint64 `json:"usersched_last_run_at"` // The PID of the userspace scheduler
NrQueued uint64 `json:"nr_queued"` // Number of tasks queued in the userspace scheduler
NrScheduled uint64 `json:"nr_scheduled"` // Number of tasks scheduled by the userspace scheduler
NrRunning uint64 `json:"nr_running"` // Number of tasks currently running in the userspace scheduler
NrOnlineCpus uint64 `json:"nr_online_cpus"` // Number of online CPUs in the system
NrUserDispatches uint64 `json:"nr_user_dispatches"` // Number of user-space dispatches
NrKernelDispatches uint64 `json:"nr_kernel_dispatches"` // Number of kernel-space dispatches
NrCancelDispatches uint64 `json:"nr_cancel_dispatches"` // Number of cancelled dispatches
NrBounceDispatches uint64 `json:"nr_bounce_dispatches"` // Number of bounce dispatches
NrFailedDispatches uint64 `json:"nr_failed_dispatches"` // Number of failed dispatches
NrSchedCongested uint64 `json:"nr_sched_congested"` // Number of times the scheduler was congested
}
BssData represents the metrics data structure that matches the API server
type ErrorResponse ¶
ErrorResponse represents error response structure
type GthulhuPlugin ¶
type GthulhuPlugin struct{}
func NewGthulhuPlugin ¶
func NewGthulhuPlugin(sliceNsDefault, sliceNsMin uint64) *GthulhuPlugin
func (*GthulhuPlugin) DetermineTimeSlice ¶
func (g *GthulhuPlugin) DetermineTimeSlice(s plugin.Sched, t *models.QueuedTask) uint64
func (*GthulhuPlugin) DrainQueuedTask ¶
func (g *GthulhuPlugin) DrainQueuedTask(s plugin.Sched) int
func (*GthulhuPlugin) GetPoolCount ¶
func (g *GthulhuPlugin) GetPoolCount() uint64
func (*GthulhuPlugin) SelectCPU ¶
func (g *GthulhuPlugin) SelectCPU(s plugin.Sched, t *models.QueuedTask) (error, int32)
func (*GthulhuPlugin) SelectQueuedTask ¶
func (g *GthulhuPlugin) SelectQueuedTask(s plugin.Sched) *models.QueuedTask
type JWTClient ¶
type JWTClient struct {
// contains filtered or unexported fields
}
JWTClient handles JWT authentication for API calls
func GetJWTClient ¶
func GetJWTClient() *JWTClient
GetJWTClient returns the current JWT client instance
func InitJWTClient ¶
InitJWTClient initializes the JWT client for API authentication
func NewJWTClient ¶
NewJWTClient creates a new JWT client
func (*JWTClient) GetAuthenticatedClient ¶
GetAuthenticatedClient returns an HTTP client with JWT authentication
type MetricsClient ¶
type MetricsClient struct {
// contains filtered or unexported fields
}
MetricsClient handles sending metrics to the API server
func NewMetricsClient ¶
func NewMetricsClient(jwtClient *JWTClient, apiBaseURL string) *MetricsClient
NewMetricsClient creates a new metrics client
func (*MetricsClient) SendMetrics ¶
func (c *MetricsClient) SendMetrics(data BssData) error
SendMetrics sends BSS metrics data to the API server
func (*MetricsClient) SendMetricsAsync ¶
func (c *MetricsClient) SendMetricsAsync(data BssData)
SendMetricsAsync sends metrics asynchronously (non-blocking)
type MetricsResponse ¶
type MetricsResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
Timestamp string `json:"timestamp"`
}
MetricsResponse represents the response structure from the API server
type SchedulingStrategiesResponse ¶
type SchedulingStrategiesResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
Timestamp string `json:"timestamp"`
Scheduling []SchedulingStrategy `json:"scheduling"`
}
SchedulingStrategiesResponse represents the response structure from the API
type SchedulingStrategy ¶
type SchedulingStrategy struct {
Priority bool `json:"priority"` // If true, set vtime to minimum vtime
ExecutionTime uint64 `json:"execution_time"` // Time slice for this process in nanoseconds
PID int `json:"pid"` // Process ID to apply this strategy to
}
SchedulingStrategy represents a strategy for process scheduling
func FetchSchedulingStrategies ¶
func FetchSchedulingStrategies(apiUrl string) ([]SchedulingStrategy, error)
FetchSchedulingStrategies fetches scheduling strategies from the API server with JWT authentication
type TokenRequest ¶
type TokenRequest struct {
PublicKey string `json:"public_key"` // PEM encoded public key
}
TokenRequest represents the request structure for JWT token generation