feat: add sched GC predicate statics; wire sel_optimize_set(1) in sched_init (6-4, 6-9)
This commit is contained in:
parent
72546d3a22
commit
acda9bb228
3 changed files with 39 additions and 1 deletions
|
|
@ -14,11 +14,30 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "preason.h"
|
#include "preason.h"
|
||||||
#include "resobj.h"
|
#include "resobj.h"
|
||||||
|
#include "resreq.h"
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "xcealloc.h"
|
#include "xcealloc.h"
|
||||||
#include "xstring.h"
|
#include "xstring.h"
|
||||||
|
|
||||||
|
static int sched_session_active(xce_scheduler_t* sched)
|
||||||
|
{
|
||||||
|
return atomic_load_explicit(&sched->session_active,
|
||||||
|
memory_order_acquire);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sched_eval_in_progress(xce_scheduler_t* sched)
|
||||||
|
{
|
||||||
|
return atomic_load_explicit(&sched->eval_in_progress,
|
||||||
|
memory_order_acquire);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sched_staging_merge_complete(xce_scheduler_t* sched)
|
||||||
|
{
|
||||||
|
return atomic_load_explicit(&sched->staging_merge_complete,
|
||||||
|
memory_order_acquire);
|
||||||
|
}
|
||||||
|
|
||||||
static void* sched_job_picker(void* arg)
|
static void* sched_job_picker(void* arg)
|
||||||
{
|
{
|
||||||
xce_sched_plugin_t* job_picker = NULL;
|
xce_sched_plugin_t* job_picker = NULL;
|
||||||
|
|
@ -356,6 +375,8 @@ int sched_init(xce_scheduler_t* sched, xce_client_config_t* config,
|
||||||
|
|
||||||
memset(sched, 0x0, sizeof(*sched));
|
memset(sched, 0x0, sizeof(*sched));
|
||||||
|
|
||||||
|
sel_optimize_set(1); /* enable CSE intern table for scheduler process */
|
||||||
|
|
||||||
sched->nextid = 1;
|
sched->nextid = 1;
|
||||||
sched->configver = 0;
|
sched->configver = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ scheduler_test_src = [
|
||||||
'test.c'
|
'test.c'
|
||||||
]
|
]
|
||||||
|
|
||||||
scheduler_test_deps = [libxce_deps, librtti_dep, unity_dep]
|
scheduler_test_deps = [libxce_deps, librtti_dep, unity_dep, libxce_dep]
|
||||||
|
|
||||||
incdir = include_directories('../include', '../../include', '.')
|
incdir = include_directories('../include', '../../include', '.')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include <unity/unity.h>
|
#include <unity/unity.h>
|
||||||
|
|
||||||
|
#include "resreq.h"
|
||||||
|
|
||||||
/* Minimal struct declaration to verify atomic fields exist.
|
/* Minimal struct declaration to verify atomic fields exist.
|
||||||
* We avoid including scheduler.h to prevent dependency on capnp headers. */
|
* We avoid including scheduler.h to prevent dependency on capnp headers. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -87,6 +89,20 @@ test_scheduler_t_has_atomic_gc_fields(void)
|
||||||
TEST_ASSERT_EQUAL_INT(0, atomic_load(&sched.staging_merge_complete));
|
TEST_ASSERT_EQUAL_INT(0, atomic_load(&sched.staging_merge_complete));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_sel_optimize_set_at_scheduler_startup(void)
|
||||||
|
{
|
||||||
|
/* sel_optimize_set(1) is called in sched_init.
|
||||||
|
* Since we can't call sched_init (it starts threads/network),
|
||||||
|
* verify the setter/getter contract directly. */
|
||||||
|
sel_optimize_set(1);
|
||||||
|
TEST_ASSERT_EQUAL_INT(1, sel_get_optimize_level());
|
||||||
|
/* reset for clean test isolation */
|
||||||
|
#ifdef UNIT_TEST
|
||||||
|
sel_optimize_test_reset();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#define TEST(x) \
|
#define TEST(x) \
|
||||||
do { \
|
do { \
|
||||||
if (check_test(&arguments, #x)) { \
|
if (check_test(&arguments, #x)) { \
|
||||||
|
|
@ -101,6 +117,7 @@ int main(int argc, char* argv[])
|
||||||
UNITY_BEGIN();
|
UNITY_BEGIN();
|
||||||
|
|
||||||
TEST(test_scheduler_t_has_atomic_gc_fields);
|
TEST(test_scheduler_t_has_atomic_gc_fields);
|
||||||
|
TEST(test_sel_optimize_set_at_scheduler_startup);
|
||||||
|
|
||||||
return UNITY_END();
|
return UNITY_END();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue