diff mbox

rt-app : add thread policy in the thread-log-file

Message ID 530ECADD.501@linaro.org
State New
Headers show

Commit Message

Sanjay Singh Rawat Feb. 27, 2014, 5:19 a.m. UTC
hello Juri,

Adding scheduling policy in the thread log header will be helpful.
This small patch (attached) adds this.

regards,
sanjay
diff mbox

Patch

From c975724027efef8b840b557bca92e2bcd5cea9de Mon Sep 17 00:00:00 2001
From: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
Date: Thu, 27 Feb 2014 10:38:12 +0530
Subject: [PATCH] log scheduling policy in per thread logs

---
 src/rt-app.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/rt-app.c b/src/rt-app.c
index 605a662..d018687 100644
--- a/src/rt-app.c
+++ b/src/rt-app.c
@@ -160,6 +160,8 @@  void *thread_body(void *arg)
 	{
 		case rr:
 		case fifo:
+			fprintf(data->log_handler, "# Policy : %s\n",
+				(data->sched_policy == rr ? "SCHED_RR" : "SCHED_FIFO"));
 			param.sched_priority = data->sched_prio;
 			ret = pthread_setschedparam(pthread_self(), 
 						    data->sched_policy, 
@@ -181,6 +183,7 @@  void *thread_body(void *arg)
 			break;
 
 		case other:
+			fprintf(data->log_handler, "# Policy : SCHED_OTHER\n");
 			log_notice("[%d] starting thread with period: %lu, exec: %lu,"
 			       "deadline: %lu",
 			       	data->ind,
@@ -192,6 +195,7 @@  void *thread_body(void *arg)
 			break;
 #ifdef AQUOSA			
 		case aquosa:
+			fprintf(data->log_handler, "# Policy : AQUOSA\n");
 			data->params.Q_min = round((timespec_to_usec(&data->min_et) * (( 100.0 + data->sched_prio ) / 100)) / (data->fragment * 1.0)); 
 			data->params.Q = round((timespec_to_usec(&data->max_et) * (( 100.0 + data->sched_prio ) / 100)) / (data->fragment * 1.0));
 			data->params.P = round(timespec_to_usec(&data->period) / (data->fragment * 1.0));
@@ -214,6 +218,7 @@  void *thread_body(void *arg)
 #endif
 #ifdef DLSCHED
 		case deadline:
+			fprintf(data->log_handler, "# Policy : SCHED_DEADLINE\n");
 			tid = gettid();
 			attr.size = sizeof(attr);
 			attr.sched_flags = 0;
-- 
1.7.10.4