About LibMCore
This library provides some functions to create asynchronous or synchronous light weight process and generic queue processing. Some other basic functions are also available to count core number, to enable realtime scheduler, to set core affinity or to manipulate cycle counters.
Usage
Function create_queue_task() creates queue task named name, with the ability to process at max a number of nb_sub_tasks sub-tasks, at real-time priority set to priority, composed of nb_sub_queues threads, assigns to cpu_list. A function init can initialize internal structures and memories. A pointer of queue_task_t is returned overwise NULL.
Function create_sync_task() create a task names name, running function task on nb_sub_tasks sub-tasks synchronously, at real-time priority set to priority, and assigns to cpu_list. A maximum of max_allowed_time_us micro-seconds can be consumed per run otherwise, the sub-task is declared as overloaded. A function init can initialize internal structures and memories. A pointer of task_t is returned overwise NULL.
Function create_async_task() creates a task named name, running function task, task at real-time priority set to priority, and assigns to cpu_list. A pointer of task_t is returned overwise NULL.
Examples
Some examples of the use of LibMCore.
A example of queue usage.
extern void huge_process_init (void); extern int huge_process (void *_param); int nb_blocks = 10; int nb_loops = 100; /* init structure */ data_t *d = (data_t *) calloc (nb_blocks, sizeof (data_t)); ... /* create queue */ queue_task_t *queue = create_queue_task ("process", 1000, 70, 2, "0+1+2+3:2", huge_process_init); for (j = 0; j < nb_loops; j++) { /* fill queue */ queue_sub_task_info_t *queue_huge_process = queue_init (queue); for (i = 0; i < nb_blocks; i++) { rc = queue_load (queue, queue_huge_process, huge_process, d + i); if (rc == 0) printf ("error %d for load %d\n", rc, i); } /* queue processing */ rc = queue_end (queue, queue_huge_process); if (rc == 0) printf ("error %d on queue ending\n", rc); /* statistics */ queue_stat (queue, 1); printf ("\n"); }
A example of synchrounous task usage.
extern void huge_process_init (void); extern int huge_process (void *_param); float process_time_us = 10000.0f; int nb_loops = 100; /* init structure */ data = (data_t *) calloc (1, sizeof (data_t)); ... /* create sync task */ task_t *process = create_sync_task ("process", huge_process, process_time_us, huge_process_init, 70, 1, "0+1+2+ /* main loop */ for (i = 0; i < nb_loops; i++, task_stat (process, 1), printf ("\n")) { task_try_trig (process); usleep (process_time_us); } /* global statistics */ task_stat (process, 0);
A example of asynchronous task usage.
extern int huge_process (void *_param); /* create sync task */ task_t *process = create_async_task ("process", huge_process, 70, 1, "0+1+2+3"); usleep (nb_loops * process_time_us); /* global statistics */ task_stat (process, 0);
Screen-shot
Shell view
Downloads
Source packages
Debian packages
- LibMCore version 1.2.1 (i386)
- LibMCore version 1.2.1 (amd64)
- LibMCore version 1.2.1 (dev i386)
- LibMCore version 1.2.1 (dev amd64)
Requirements
This library only need a C compiler to be build. Some features are only available on a Linux system.
To install, one only needs to
- unpack the archive,
- do a 'make',
- and a 'make install'.
Changelogs
LibMCore 1.2.1 (Tue, 03 Jun 2014 22:03:14 +0200)
- Split debian packaging
LibMCore 1.2 (Tue, 17 Sep 2013 12:15:50 +0200)
- First public version
- Cleaning of task management headers; add prefix task_, reorder function
- Remove some warnings
- Fix cpu_list processing
LibMCore 1.0 (Tue, 6 Mar 2012 09:52:32 +0200)
- Initial version