summaryrefslogtreecommitdiff
path: root/samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c
diff options
context:
space:
mode:
authorYonattan Louise <yonattan.a.louise.mendoza@intel.com>2015-05-14 16:30:48 -0500
committerAnas Nashif <anas.nashif@intel.com>2016-02-05 20:13:59 -0500
commitdbada63eee8516d35d11c1543788e742b70172e1 (patch)
tree6f6556441918eecadd2495e4e2944138422accf5 /samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c
parentd133f9661d670ca5340dd032ba3630f44d995af9 (diff)
Fix coding style issues.
Some checkpatch issues were solved by scripts leaving other problems such as alignment and indentation issues. In order to comply with the defined coding style the following fixes were made: - Fixed the function declaration moving the parameters' comments above the function in accordance to the doxygen format. - Fixed functions' opening and closing brackets. These brackets should not be indented. - Fixed the 'if', 'for' and 'while' statements adding the brackets around the sentence. - Fixed comments' alignment. - Fixed indentation. The work was done manually and submitted as one commit. I didn't separate these changes in different commits because they were fixed all at once. Basically, all errors were fixed in every file at once. Change-Id: Icc94a10bfd2cff82007ce60df23b2ccd4c30268d Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
Diffstat (limited to 'samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c')
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c b/samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c
index 15ee63d3b..88f37504b 100644
--- a/samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c
+++ b/samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c
@@ -62,12 +62,12 @@ static uint32_t helper_task_iterations = 0;
*/
void yieldingTask(void)
- {
+{
while (helper_task_iterations < NB_OF_YIELD) {
- task_yield();
- helper_task_iterations++;
- }
+ task_yield();
+ helper_task_iterations++;
}
+}
/*******************************************************************************
*
@@ -79,60 +79,60 @@ void yieldingTask(void)
*/
void microTaskSwitchYield(void)
- {
+{
uint32_t iterations = 0;
int32_t delta;
uint32_t timestamp;
PRINT_FORMAT(" 5- Measure average context switch time between tasks using"
- " (task_yield)");
+ " (task_yield)");
bench_test_start();
- /* launch helper task of the same priority than this routine */
+ /* launch helper task of the same priority than this routine */
task_start(YIELDTASK);
- /* get initial timestamp */
+ /* get initial timestamp */
timestamp = TIME_STAMP_DELTA_GET(0);
- /* loop until either helper or this routine reaches number of yields */
+ /* loop until either helper or this routine reaches number of yields */
while (iterations < NB_OF_YIELD && helper_task_iterations < NB_OF_YIELD) {
- task_yield();
- iterations++;
+ task_yield();
+ iterations++;
}
- /* get the number of cycles it took to do the test */
+ /* get the number of cycles it took to do the test */
timestamp = TIME_STAMP_DELTA_GET(timestamp);
- /* Ensure both helper and this routine were context switching back & forth.
- * For execution to reach the line below, either this routine or helper
- * routine reached NB_OF_YIELD. The other loop must be at most one
- * iteration away from reaching NB_OF_YIELD if execute was switching back
- * and forth.
- */
+ /* Ensure both helper and this routine were context switching back & forth.
+ * For execution to reach the line below, either this routine or helper
+ * routine reached NB_OF_YIELD. The other loop must be at most one
+ * iteration away from reaching NB_OF_YIELD if execute was switching back
+ * and forth.
+ */
delta = iterations - helper_task_iterations;
if (bench_test_end() < 0) {
- errorCount++;
- PRINT_OVERFLOW_ERROR();
+ errorCount++;
+ PRINT_OVERFLOW_ERROR();
}
else if (abs(delta) > 1) {
- /* expecting even alternating context switch, seems one routine
- * called yield without the other having chance to execute
- */
- errorCount++;
- PRINT_FORMAT(" Error, iteration:%lu, helper iteration:%lu",
- iterations, helper_task_iterations);
+ /* expecting even alternating context switch, seems one routine
+ * called yield without the other having chance to execute
+ */
+ errorCount++;
+ PRINT_FORMAT(" Error, iteration:%lu, helper iteration:%lu",
+ iterations, helper_task_iterations);
}
else {
- /* task_yield is called (iterations + helper_task_iterations)
- * times in total.
- */
- PRINT_FORMAT(" Average task context switch using "
- "yield %lu tcs = %lu nsec",
- timestamp / (iterations + helper_task_iterations),
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp,
- (iterations + helper_task_iterations)));
- }
+ /* task_yield is called (iterations + helper_task_iterations)
+ * times in total.
+ */
+ PRINT_FORMAT(" Average task context switch using "
+ "yield %lu tcs = %lu nsec",
+ timestamp / (iterations + helper_task_iterations),
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp,
+ (iterations + helper_task_iterations)));
}
+}
#endif