]> rtime.felk.cvut.cz Git - frescor/fna.git/commitdiff
add the modules for the frescan sched analysis with an initial API that we are discus...
authorsangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Tue, 15 Apr 2008 08:20:17 +0000 (08:20 +0000)
committersangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Tue, 15 Apr 2008 08:20:17 +0000 (08:20 +0000)
git-svn-id: http://www.frescor.org/private/svn/frescor/fna/trunk@1109 35b4ef3e-fd22-0410-ab77-dab3279adceb

src_frescan/TODO
src_frescan/frescan_sched_analysis.c [new file with mode: 0644]
src_frescan/frescan_sched_analysis.h [new file with mode: 0644]

index 951582d42ef4844995cf6c6f3eeb8e340a01b600..cfebaebbc67d5e68c5f3c8e972766968265a663f 100644 (file)
@@ -1,4 +1,4 @@
-- LOCKS to protect the share structures
+- LOCKS to protect the shared structures
 - Renegotiate, cancel contract
 - reserve commit functions
 - use an internal thread as a bottom half for irq hooks
diff --git a/src_frescan/frescan_sched_analysis.c b/src_frescan/frescan_sched_analysis.c
new file mode 100644 (file)
index 0000000..b3661f7
--- /dev/null
@@ -0,0 +1,206 @@
+/*!
+ * @file frescan_sched_analysis.c
+ *
+ * @brief FRESCAN sched analysis queue
+ *
+ * This module contains the scheduling analysis data and functions for the
+ * admission tests and spare capacity distribution of the negotiation layer.
+ * It provides an easy API easy to understand and in the implementation part
+ * it makes call to the general sched analysis module of FRSH which is shared
+ * with the CPU contracts layer in FRSH.
+ *
+ * EXAMPLE of utilization:
+ *
+ * INITIALIZATION
+ * --------------
+ * params.min_prio = 0;
+ * params.max_prio = 16;
+ * params.overhead = ...;
+ * frescan_sa_init(&scenario, &params);
+ *
+ * NEGOTIATE
+ * ---------
+ * fadt_freelist_alloc(&freelist_contracts, &id);
+ * frescan_sa_add_contract(&scenario, &contracts[id], id);
+ * frescan_sa_sched_test(&scenario, &success);
+ *
+ * if (!success) {
+ *      frescan_sa_remove_contract(&scenario, id);
+ * } else {
+ *      frescan_sa_spare_capacity(&scenario);
+ *      vres_id = to_vres(resource_type, resource_id, id);
+ *      create vres runtime structures;
+ *
+ *      for vres_id in active_vres_id {
+ *                frescan_sa_get_final_values(&scenario,
+ *                                            to_index(vres_id),
+ *                                            &final_values);
+ *                update vres runtime structures if necessary;
+ *      }
+ * }
+ *
+ * RENEGOTIATE
+ * -----------
+ * copy old_contract
+ * frescan_sa_update_contract(&scenario, to_index(vres_id), &contract);
+ * frescan_sa_sched_test(&scenario, &success);
+ *
+ * if (!success) {
+ *         frescan_sa_update_contract(&sa_data,
+ *                                    to_index(vres_id),
+ *                                    &old_contract);
+ * } else {
+ *      frescan_sa_spare_capacity(&scenario);
+ *      for vres_id in active_vres_id {
+ *              frescan_sa_get_final_values(&scenario,
+ *                                          to_index(vres_id),
+ *                                          &final_values);
+ *              update vres runtime structures if necessary;
+ *      }
+ * }
+ *
+ * CANCEL
+ * ------
+ * frescan_sa_remove_contract(&scenario, to_index(vres_id));
+ * frescan_sa_spare_capacity(&scenario);
+ *
+ * @version 0.01
+ *
+ * @date 15-Apr-2008
+ *
+ * @author Daniel Sangorrin <daniel.sangorrin@unican.es>
+ *
+ */
+
+#include "frescan_sched_analysis.h"
+#undef ERROR
+#include "frescan_debug.h"
+// #include "frsh_sa_tools.h"
+
+
+/**
+ * frescan_sa_init() - init the scenario
+ */
+
+int frescan_sa_init(frsh_sa_scenario_t *scenario,         // in out
+                    const frsh_sa_init_params_t *params)  // in
+{
+//         int ret;
+//
+//         ret = frsh_sa_scenario_init(scenario, params);
+//         return ret;
+        WARNING("not implemented, returning 0\n");
+        return 0;
+}
+
+/**
+ * frescan_sa_add_contract() - add a contract to the scenario
+ */
+
+int frescan_sa_add_contract(frsh_sa_scenario_t    *scenario, // in out
+                            const frsh_contract_t *contract, // in
+                            frsh_vres_index_t     id)        // in
+{
+//         int ret;
+//
+//         ret = frsh_sa_scenario_add_vres(scenario, contract, id);
+//         return ret;
+        WARNING("not implemented, returning 0\n");
+        return 0;
+}
+
+/**
+ * frescan_sa_update_contract() - update a contract in the scenario
+ */
+
+int frescan_sa_update_contract(frsh_sa_scenario_t    *scenario, // in out
+                               frsh_vres_index_t     id,        // in
+                               const frsh_contract_t *contract) // in
+{
+//         int ret;
+//
+//         ret = frsh_sa_scenario_modify_vres(scenario, id, *contract);
+//         return ret;
+        WARNING("not implemented, returning 0\n");
+        return 0;
+}
+
+/**
+ * frescan_sa_remove_contract() - remove a contract from the scenario
+ */
+
+int frescan_sa_remove_contract(frsh_sa_scenario_t *scenario,  // in out
+                               frsh_vres_index_t id)          // in
+{
+//         int ret;
+//
+//         ret = frsh_sa_scenario_del_vres(scenario, id);
+//         return ret;
+        WARNING("not implemented, returning 0\n");
+        return 0;
+}
+
+/**
+ * frescan_sa_sched_test() - perform a scheduling test on the scenario
+ */
+
+int frescan_sa_sched_test(frsh_sa_scenario_t *scenario,  // in out
+                          bool *success)                 // out
+{
+//         int ret;
+//
+//         ret = frsh_sa_scenario_reset_to_min(scenario, NULL, NULL);
+//         if (ret != 0) goto error;
+//
+//         ret = frsh_sa_assign_priorities(scenario, NULL, NULL, NULL, NULL);
+//         if (ret != 0) goto error;
+//
+//         ret = frsh_sa_ceilings_ok(scenario);
+//         if (ret != 0) goto error;
+//
+//         ret = frsh_sa_calculate_blockings(scenario);
+//         if (ret != 0) goto error;
+//
+//         ret = frsh_sa_sched_test(scenario, success);
+//         if (ret != 0) goto error;
+//
+//         return 0;
+//
+// error:
+//         *success = false;
+//         return ret;
+        WARNING("not implemented, returning 0\n");
+        return 0;
+}
+
+/**
+ * frescan_sa_spare_capacity() - distribute the remaining spare capacity
+ */
+
+int frescan_sa_spare_capacity(frsh_sa_scenario_t *scenario) // in out
+{
+//         int ret;
+//
+//         ret = frsh_sa_distribute_spare(scenario,
+//                                        NULL, NULL, NULL, NULL, NULL, NULL);
+//         return ret;
+        WARNING("not implemented, returning 0\n");
+        return 0;
+}
+
+/**
+ * sa_get_final_values() - get the final values
+ */
+
+int sa_get_final_values(const frsh_sa_scenario_t *scenario,      // in
+                        frsh_vres_index_t id,                    // in
+                        frescan_sa_final_values_t *final_values) // out
+{
+//         final_values->budget   = scenario->sa_vres_alloc[id].c;
+//         final_values->period   = scenario->sa_vres_alloc[id].t;
+//         final_values->deadline = scenario->sa_vres_alloc[id].d;
+//         final_values->priority = scenario->sa_vres_alloc[id].p;
+//         return 0;
+        WARNING("not implemented, returning 0\n");
+        return 0;
+}
diff --git a/src_frescan/frescan_sched_analysis.h b/src_frescan/frescan_sched_analysis.h
new file mode 100644 (file)
index 0000000..d1568d6
--- /dev/null
@@ -0,0 +1,137 @@
+/*!
+ * @file frescan_sched_analysis.h
+ *
+ * @brief FRESCAN sched analysis queue
+ *
+ * This module contains the scheduling analysis data and functions for the
+ * admission tests and spare capacity distribution of the negotiation layer.
+ * It provides an easy API easy to understand and in the implementation part
+ * it makes call to the general sched analysis module of FRSH which is shared
+ * with the CPU contracts layer in FRSH.
+ *
+ * EXAMPLE of utilization:
+ *
+ * INITIALIZATION
+ * --------------
+ * params.min_prio = 0;
+ * params.max_prio = 16;
+ * params.overhead = ...;
+ * frescan_sa_init(&scenario, &params);
+ *
+ * NEGOTIATE
+ * ---------
+ * fadt_freelist_alloc(&freelist_contracts, &id);
+ * frescan_sa_add_contract(&scenario, &contracts[id], id);
+ * frescan_sa_sched_test(&scenario, &success);
+ *
+ * if (!success) {
+ *      frescan_sa_remove_contract(&scenario, id);
+ * } else {
+ *      frescan_sa_spare_capacity(&scenario);
+ *      vres_id = to_vres(resource_type, resource_id, id);
+ *      create vres runtime structures;
+ *
+ *      for vres_id in active_vres_id {
+ *                frescan_sa_get_final_values(&scenario,
+ *                                            to_index(vres_id),
+ *                                            &final_values);
+ *                update vres runtime structures if necessary;
+ *      }
+ * }
+ *
+ * RENEGOTIATE
+ * -----------
+ * copy old_contract
+ * frescan_sa_update_contract(&scenario, to_index(vres_id), &contract);
+ * frescan_sa_sched_test(&scenario, &success);
+ *
+ * if (!success) {
+ *         frescan_sa_update_contract(&sa_data,
+ *                                    to_index(vres_id),
+ *                                    &old_contract);
+ * } else {
+ *      frescan_sa_spare_capacity(&scenario);
+ *      for vres_id in active_vres_id {
+ *              frescan_sa_get_final_values(&scenario,
+ *                                          to_index(vres_id),
+ *                                          &final_values);
+ *              update vres runtime structures if necessary;
+ *      }
+ * }
+ *
+ * CANCEL
+ * ------
+ * frescan_sa_remove_contract(&scenario, to_index(vres_id));
+ * frescan_sa_spare_capacity(&scenario);
+ *
+ * @version 0.01
+ *
+ * @date 15-Apr-2008
+ *
+ * @author Daniel Sangorrin <daniel.sangorrin@unican.es>
+ *
+ */
+
+#ifndef _FRESCAN_SCHED_ANALYSIS_H_
+#define _FRESCAN_SCHED_ANALYSIS_H_
+
+#include "frsh.h"
+
+// #include "frsh_sa_scenario.h"
+typedef int frsh_sa_scenario_t;
+typedef int frsh_sa_init_params_t;
+typedef int frsh_vres_index_t;
+typedef int frescan_sa_final_values_t;
+
+/**
+ * frescan_sa_init() - init the scenario
+ */
+
+extern int frescan_sa_init(frsh_sa_scenario_t *scenario,         // in out
+                           const frsh_sa_init_params_t *params); // in
+
+/**
+ * frescan_sa_add_contract() - add a contract to the scenario
+ */
+
+extern int frescan_sa_add_contract(frsh_sa_scenario_t    *scenario, // in out
+                                   const frsh_contract_t *contract, // in
+                                   frsh_vres_index_t     id);       // in
+
+/**
+ * frescan_sa_update_contract() - update a contract in the scenario
+ */
+
+extern int frescan_sa_update_contract(frsh_sa_scenario_t    *scenario, // in out
+                                      frsh_vres_index_t     id,        // in
+                                      const frsh_contract_t *contract);// in
+
+/**
+ * frescan_sa_remove_contract() - remove a contract from the scenario
+ */
+
+extern int frescan_sa_remove_contract(frsh_sa_scenario_t *scenario,  // in out
+                                      frsh_vres_index_t id);         // in
+
+/**
+ * frescan_sa_sched_test() - perform a scheduling test on the scenario
+ */
+
+extern int frescan_sa_sched_test(frsh_sa_scenario_t *scenario,  // in out
+                                 bool *success);                // out
+
+/**
+ * frescan_sa_spare_capacity() - distribute the remaining spare capacity
+ */
+
+extern int frescan_sa_spare_capacity(frsh_sa_scenario_t *scenario); // in out
+
+/**
+ * sa_get_final_values() - get the final values
+ */
+
+extern int sa_get_final_values(const frsh_sa_scenario_t *scenario,       // in
+                               frsh_vres_index_t id,                     // in
+                               frescan_sa_final_values_t *final_values); // out
+
+#endif // _FRESCAN_REQUESTS_QUEUE_H_