+/**************************************************************************/
+/* ---------------------------------------------------------------------- */
+/* Copyright (C) 2006 - 2008 FRESCOR consortium partners: */
+/* */
+/* Universidad de Cantabria, SPAIN */
+/* University of York, UK */
+/* Scuola Superiore Sant'Anna, ITALY */
+/* Kaiserslautern University, GERMANY */
+/* Univ. Politécnica Valencia, SPAIN */
+/* Czech Technical University in Prague, CZECH REPUBLIC */
+/* ENEA SWEDEN */
+/* Thales Communication S.A. FRANCE */
+/* Visual Tools S.A. SPAIN */
+/* Rapita Systems Ltd UK */
+/* Evidence ITALY */
+/* */
+/* See http://www.frescor.org for a link to partners' websites */
+/* */
+/* FRESCOR project (FP6/2005/IST/5-034026) is funded */
+/* in part by the European Union Sixth Framework Programme */
+/* The European Union is not liable of any use that may be */
+/* made of this code. */
+/* */
+/* */
+/* This file is part of FRSH (FRescor ScHeduler) */
+/* */
+/* FRSH is free software; you can redistribute it and/or modify it */
+/* under terms of the GNU General Public License as published by the */
+/* Free Software Foundation; either version 2, or (at your option) any */
+/* later version. FRSH is distributed in the hope that it will be */
+/* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
+/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
+/* General Public License for more details. You should have received a */
+/* copy of the GNU General Public License along with FRSH; see file */
+/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
+/* Cambridge, MA 02139, USA. */
+/* */
+/* As a special exception, including FRSH header files in a file, */
+/* instantiating FRSH generics or templates, or linking other files */
+/* with FRSH objects to produce an executable application, does not */
+/* by itself cause the resulting executable application to be covered */
+/* by the GNU General Public License. This exception does not */
+/* however invalidate any other reasons why the executable file might be */
+/* covered by the GNU Public License. */
+/**************************************************************************/
+
+/**
+ * @file fres_vres.h
+ * @author Michal Sojka <sojkam1@fel.cvut.cz>
+ * @date Wed Feb 18 16:00:15 2009
+ *
+ * @brief VRES definition
+ *
+ *
+ */
+
#ifndef FRES_VRES_H
#define FRES_VRES_H
+#include <fosa.h>
+
#include <fres_contract_idl.h>
#include <ul_gavlcust.h>
typedef struct fres_vres {
/** Contracts IDs of this VRES. */
fres_contract_id_t id;
-
+
/**
* Stores actual allocation of the resource. During a mode
* change, the callbacks can compare this old allocation with
- * the changed (stored in @a new) one and depending on the
- * kind of difference, it can apply the change
+ * the changed one (stored in @a new) and depending on the
+ * kind of difference, they can apply the change
* differently. Callbacks must not change this field. as well as
* the @a perceived field.
*/
/**
* The schedulable contract received by the allocator. The
- * shceduler callback should use this contract to
+ * allocator callbacks should use this contract to
* create/change VRES and must not change the value of this
* field.
*/
struct fres_contract *new;
-
+
struct fres_allocator *allocator;
void *priv; /**< Resource allocator private data */
gavl_node_t node;
fres_vres_t *fres_vres_new(fres_contract_id_t *id);
void fres_vres_destroy(fres_vres_t *vres);
+/**
+ * Representation of thread to VRES binding.
+ */
+typedef struct fres_thread_vres {
+ fosa_thread_id_t id;
+ fres_vres_t *vres;
+
+ fosa_abs_time_t job_start_time;
+ fosa_abs_time_t job_cpu_time;
+
+ gavl_node_t node;
+} fres_thread_vres_t;
+
+static inline
+int fres_thread_vres_cmp(const fosa_thread_id_t *a, const fosa_thread_id_t *b)
+{
+ return fosa_thread_equal(*a, *b);
+}
+
+fres_thread_vres_t *fres_thread_vres_new
+ (const fosa_thread_id_t *id,
+ fres_vres_t *vres);
+
+void fres_thread_vres_destroy(fres_thread_vres_t *th_vres);
#endif