diff options
author | Mahircan Gul <mahircg@mpi-sws.org> | 2016-07-18 10:05:20 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-07-18 10:46:23 -0400 |
commit | cf1d1f6e4b1138a5a841a47a2cba4aacdcaf0d72 (patch) | |
tree | 0f78c6a6a131700800c2f9dc7bf4768a775857e9 /include | |
parent | 11a2acc387b274d2323104272e585a7059b96f4f (diff) |
Add unit-test for CPU mapping parsing
- Decompose read_mapping into two functions: *read_mapping* which reads
CPU mapping data as string from file, and *set_mapping* that actually sets
the cpu_set_t according to the mapping
- Add unit test for setting cpu_set_t to various CPU indexes
Diffstat (limited to 'include')
-rw-r--r-- | include/migration.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/migration.h b/include/migration.h index f60dfe9..bd52dd4 100644 --- a/include/migration.h +++ b/include/migration.h | |||
@@ -3,6 +3,7 @@ | |||
3 | * Functions to migrate tasks to different CPUs, partitions, clusters... | 3 | * Functions to migrate tasks to different CPUs, partitions, clusters... |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <sched.h> | ||
6 | typedef int pid_t; | 7 | typedef int pid_t; |
7 | 8 | ||
8 | /** | 9 | /** |
@@ -58,6 +59,20 @@ int be_migrate_to_cluster(int cluster, int cluster_sz); | |||
58 | int be_migrate_to_domain(int domain); | 59 | int be_migrate_to_domain(int domain); |
59 | 60 | ||
60 | /** | 61 | /** |
62 | * Parse CPU set given as string, and return corresponding cpu_set_t variable | ||
63 | * and its size as parameters. | ||
64 | * @param buf CPU mapping as string. Specific format is explained in | ||
65 | * src/migration.c:82 | ||
66 | * @param len Length of input string in bytes | ||
67 | * @param set cpu_set_t type variable with bits set as according to input | ||
68 | * @param sz Size of CPU set in bytes | ||
69 | * @return void | ||
70 | */ | ||
71 | |||
72 | void set_mapping(char* buf, int len, cpu_set_t** set, size_t *sz); | ||
73 | |||
74 | |||
75 | /** | ||
61 | * Return the number of CPUs currently online | 76 | * Return the number of CPUs currently online |
62 | * @return The number of online CPUs | 77 | * @return The number of online CPUs |
63 | */ | 78 | */ |