ROVER - Script to obtain the granularity of the threads of a process added.

This can be used for the Eclipse application of Rover.

Signed-off-by: Mustafa Ozcelikors <mozcelikors@gmail.com>
diff --git a/rover/src/tracing/ProfileThreadsOfAProcess.sh b/rover/src/tracing/ProfileThreadsOfAProcess.sh
new file mode 100644
index 0000000..a0eae0c
--- /dev/null
+++ b/rover/src/tracing/ProfileThreadsOfAProcess.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# Copyright (c) 2017 FH Dortmund and others
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Description:
+#	This script is used for estimating the granularity of a thread by
+#	making use of its name and period.
+#	Right usage: ProfileThreadsOfAProcess.sh <process_name> <period> <perf_command>
+#					e.g. ProfileThreadsOfAProcess.sh <process_name> <period> <perf_command>
+#					<period> is in milliseconds
+#	
+# Authors:
+#	M. Ozcelikors <mozcelikors@gmail.com>, FH Dortmund
+#
+
+args=("$@")
+process_name=${args[0]}
+period=${args[1]}
+perf_command=${args[2]} 
+
+if [ "$#" -ne 3 ]; then
+	echo "Entered arguments seem to be incorrect"
+	echo "Right usage: ProfileThreadsOfAProcess.sh <process_name> <period> <perf_command>"
+	echo "e.g. ProfileThreadsOfAProcess.sh parking_task 450 perf"
+	echo "<period> is in milliseconds"
+else
+	pid=$(pgrep -f $process_name -o)
+	$perf_command stat --per-thread -e instructions:u -p $pid -I $period 
+fi
+
+
+
+
+