config, task_factory: api 49/180949/9
authorMichal Kolodziejski <m.kolodziejs@samsung.com>
Wed, 6 Jun 2018 14:32:16 +0000 (16:32 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 14 Jun 2018 15:38:06 +0000 (15:38 +0000)
Change-Id: I9955421bcee4cbcf419d27743dcde1f1b3ad5cef
Signed-off-by: Michal Kolodziejski <m.kolodziejs@samsung.com>
src/config.c [new file with mode: 0644]
src/config.h [new file with mode: 0644]
src/task_factory.c [new file with mode: 0644]
src/task_factory.h [new file with mode: 0644]

diff --git a/src/config.c b/src/config.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/config.h b/src/config.h
new file mode 100644 (file)
index 0000000..9f1a1a5
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CONFIG_H_
+#define __CONFIG_H_
+
+/**
+ * @brief Config scope options.
+ */
+typedef enum config_scope
+{
+    /**
+     * @brief Observe whole system resources.
+     */
+    SYSTEM,
+
+    /**
+     * @brief Observe system resources used by one or more app.
+     */
+    APPS,
+
+    /**
+     * @brief Observe one ore more CPU core usage.
+     */
+    CORES
+} config_scope_e;
+
+/**
+ * @brief Config options flags.
+ */
+typedef enum config_options
+{
+    /**
+     * @brief Observe cpu usage.
+     */
+    OBSERVE_CPU = 1,
+
+    /**
+     * @brief Observe memory usage.
+     */
+    OBSERVE_MEMORY = 1 << 1
+} config_options_e;
+
+/**
+ * @brief Config structure.
+ * @remarks
+ *     If scope is set to system field config_data is ignored.
+ *     If scope is set to apps or cores, config_data must contains list of apps or core numbers accordingly.
+ */
+typedef struct config
+{
+    /**
+     * @brief Config scope.
+     */
+    config_scope_e scope;
+
+    /**
+     * @brief Null-terminated array of strings with config data.
+     * @remarks It can contain list of applications or cores number.
+     */
+    char **config_data;
+
+    /**
+     * @brief Config options.
+     */
+    int options;
+} config_t;
+
+#endif
\ No newline at end of file
diff --git a/src/task_factory.c b/src/task_factory.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/task_factory.h b/src/task_factory.h
new file mode 100644 (file)
index 0000000..795a994
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+     * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TASK_FACTORY_H_
+#define __TASK_FACTORY_H_
+
+#include "config.h"
+#include "task.h"
+
+/**
+ * @brief Creates new task.
+ * @param[in] config Task configuration depends o it.
+ * @return Returns task structure.
+ */
+task_t task_factory_create_single(const config_t *config);
+
+/**
+ * @brief Creates one or more tasks.
+ * @param[in] configs Tasks configurations depends o those.
+ * @return Returns null terminated array of task structures.
+ */
+task_t *task_factory_create_many(const config_t **configs);
+
+#endif
\ No newline at end of file