LCOV - code coverage report
Current view: top level - module/event/subsystems/scheduler - scheduler.c (source / functions) Hit Total Coverage
Test: ut_cov_unit.info Lines: 0 29 0.0 %
Date: 2024-12-16 00:23:21 Functions: 0 4 0.0 %

          Line data    Source code
       1             : /*   SPDX-License-Identifier: BSD-3-Clause
       2             :  *   Copyright (C) 2021 Intel Corporation.
       3             :  *   All rights reserved.
       4             :  */
       5             : 
       6             : #include "spdk/stdinc.h"
       7             : #include "spdk/env.h"
       8             : #include "spdk/scheduler.h"
       9             : 
      10             : #include "spdk_internal/event.h"
      11             : #include "spdk_internal/init.h"
      12             : 
      13             : static void
      14           0 : scheduler_subsystem_init(void)
      15             : {
      16           0 :         int rc = 0;
      17             : 
      18             :         /* Set the defaults */
      19           0 :         if (spdk_scheduler_get() == NULL) {
      20           0 :                 rc = spdk_scheduler_set("static");
      21             :         }
      22             : 
      23           0 :         spdk_subsystem_init_next(rc);
      24           0 : }
      25             : 
      26             : static void
      27           0 : scheduler_subsystem_fini(void)
      28             : {
      29           0 :         spdk_scheduler_set_period(0);
      30           0 :         spdk_scheduler_set(NULL);
      31             : 
      32           0 :         spdk_subsystem_fini_next();
      33           0 : }
      34             : 
      35             : static void
      36           0 : scheduler_write_config_json(struct spdk_json_write_ctx *w)
      37             : {
      38             :         struct spdk_scheduler *scheduler;
      39             :         uint64_t scheduler_period;
      40             : 
      41           0 :         assert(w != NULL);
      42             : 
      43           0 :         scheduler = spdk_scheduler_get();
      44           0 :         if (scheduler == NULL) {
      45           0 :                 SPDK_ERRLOG("Unable to get scheduler info\n");
      46           0 :                 return;
      47             :         }
      48             : 
      49           0 :         scheduler_period = spdk_scheduler_get_period();
      50             : 
      51           0 :         spdk_json_write_array_begin(w);
      52             : 
      53           0 :         spdk_json_write_object_begin(w);
      54           0 :         spdk_json_write_named_string(w, "method", "framework_set_scheduler");
      55           0 :         spdk_json_write_named_object_begin(w, "params");
      56           0 :         spdk_json_write_named_string(w, "name", scheduler->name);
      57           0 :         if (scheduler_period != 0) {
      58           0 :                 spdk_json_write_named_uint32(w, "period", scheduler_period);
      59             :         }
      60           0 :         spdk_json_write_object_end(w);
      61           0 :         spdk_json_write_object_end(w);
      62             : 
      63           0 :         spdk_json_write_array_end(w);
      64             : }
      65             : 
      66             : static struct spdk_subsystem g_spdk_subsystem_scheduler = {
      67             :         .name = "scheduler",
      68             :         .init = scheduler_subsystem_init,
      69             :         .fini = scheduler_subsystem_fini,
      70             :         .write_config_json = scheduler_write_config_json,
      71             : };
      72             : 
      73           0 : SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_scheduler);

Generated by: LCOV version 1.15