My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Functions
scheduling.c File Reference
#include "dfg.h"
#include "controller_dfg.h"
#include "scheduling.h"
#include "api.h"
#include "logging.h"
#include "runtime_messages.h"
#include "controller_stats.h"
#include "msu_ids.h"
#include "haproxy.h"
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

Go to the source code of this file.

Macros

#define QLEN_ROUTING
 

Functions

static int UNUSED n_downstream_msus (struct dfg_msu *msu)
 
static double get_q_len (struct dfg_msu *msu)
 
static int downstream_q_len (struct dfg_msu *msu)
 
static int fix_route_ranges (struct dfg_route *route)
 
int fix_all_route_ranges (struct dedos_dfg *dfg)
 
int msu_hierarchical_sort (struct dfg_msu **msus)
 Based on the meta routing, sort msus in a list in ascending order (from leaf to root) More...
 
void prepare_clone (struct dfg_msu *msu)
 Find an ID and clean up data structures for an MSU. More...
 
struct dfg_threadfind_unused_thread (struct dfg_runtime *runtime, struct dfg_msu_type *type, int is_pinned)
 Find a suitable thread for an MSU. More...
 
int place_on_runtime (struct dfg_runtime *rt, struct dfg_msu *msu)
 Find a core on which to spawn a new thread for an MSU. More...
 
struct dfg_dependencyget_dependency (struct dfg_msu_type *type, struct dfg_msu_type *dep_type)
 
int wire_msu (struct dfg_msu *msu)
 
static int remove_routes_to_msu (struct dfg_msu *msu)
 
static int get_dependencies (struct dfg_msu *msu, struct dfg_msu **output, int out_size)
 
int unclone_msu (int msu_id)
 
struct dfg_msuclone_msu (int msu_id)
 Clone a msu of given ID. More...
 
int schedule_msu (struct dfg_msu *msu, struct dfg_runtime *rt, struct dfg_msu **new_msus)
 Tries to place an MSU on a given runtime. More...
 

Macro Definition Documentation

#define QLEN_ROUTING

Definition at line 44 of file scheduling.c.

Function Documentation

struct dfg_msu* clone_msu ( int  msu_id)

Clone a msu of given ID.

Parameters
msu_idid of the MSU to clone
Returns
0/-1 success/failure

Definition at line 619 of file scheduling.c.

static int downstream_q_len ( struct dfg_msu msu)
static

Definition at line 57 of file scheduling.c.

struct dfg_thread* find_unused_thread ( struct dfg_runtime runtime,
struct dfg_msu_type type,
int  is_pinned 
)

Find a suitable thread for an MSU.

Parameters
dfg_runtime*runtime: pointer to runtime endpoint
intcolocation_group: colocation group ID to filter
intmsu_type: MSU type ID to filter
Returns
: pointer to dfg_thread or NULL

Definition at line 272 of file scheduling.c.

int fix_all_route_ranges ( struct dedos_dfg dfg)

Definition at line 179 of file scheduling.c.

static int fix_route_ranges ( struct dfg_route route)
static

Definition at line 71 of file scheduling.c.

static int get_dependencies ( struct dfg_msu msu,
struct dfg_msu **  output,
int  out_size 
)
static

Definition at line 529 of file scheduling.c.

struct dfg_dependency* get_dependency ( struct dfg_msu_type type,
struct dfg_msu_type dep_type 
)

Definition at line 346 of file scheduling.c.

static double get_q_len ( struct dfg_msu msu)
static

Definition at line 48 of file scheduling.c.

int msu_hierarchical_sort ( struct dfg_msu **  msus)

Based on the meta routing, sort msus in a list in ascending order (from leaf to root)

Parameters
structdfg_msu *msus: decayed pointer to a list of MSU pointers
Returns
-1/0: failure/success

Definition at line 198 of file scheduling.c.

static int UNUSED n_downstream_msus ( struct dfg_msu msu)
static

Definition at line 33 of file scheduling.c.

int place_on_runtime ( struct dfg_runtime rt,
struct dfg_msu msu 
)

Find a core on which to spawn a new thread for an MSU.

Parameters
dfg_runtimethe target runtime
structdfg_msu_msu: the target MSU
Returns
failure/success: -1/0

Definition at line 317 of file scheduling.c.

void prepare_clone ( struct dfg_msu msu)

Find an ID and clean up data structures for an MSU.

Parameters
dfg_msumsu: target MSU
Returns
none

Definition at line 260 of file scheduling.c.

static int remove_routes_to_msu ( struct dfg_msu msu)
static

Definition at line 506 of file scheduling.c.

int schedule_msu ( struct dfg_msu msu,
struct dfg_runtime rt,
struct dfg_msu **  new_msus 
)

Tries to place an MSU on a given runtime.

Will wire the MSU with all upstream and downstream MSU, enforcing locality constraints. Also, will spawn any missing dependency.

Parameters
structdfg_msu msu: the target MSU
structdfg_runtime: the target runtime
Returns
0/-1 success/failure

Definition at line 710 of file scheduling.c.

int unclone_msu ( int  msu_id)

Definition at line 566 of file scheduling.c.

int wire_msu ( struct dfg_msu msu)

Definition at line 355 of file scheduling.c.