A4MCAR - Scripts that are related to process manipulation added.

Signed-off-by: Mustafa Ozcelikors <mozcelikors@gmail.com>
diff --git a/a4mcar/high_level_applications/scripts/process_manipulation/AppMonitor.sh b/a4mcar/high_level_applications/scripts/process_manipulation/AppMonitor.sh
new file mode 100644
index 0000000..e549ce1
--- /dev/null
+++ b/a4mcar/high_level_applications/scripts/process_manipulation/AppMonitor.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+#	Copyright (c) 2017 FH Dortmund.
+#	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
+
+# Prints the process stats given the process name
+# Usage: bash AppMonitor.sh <process_name> 
+# ATTENTION! Do not run as root
+
+args=("$@")
+process_name=${args[0]}
+pid=$(pgrep -f $process_name -n ) #Newest result
+
+sudo perf stat -p $pid
+
diff --git a/a4mcar/high_level_applications/scripts/process_manipulation/CorePlacer.sh b/a4mcar/high_level_applications/scripts/process_manipulation/CorePlacer.sh
new file mode 100644
index 0000000..331e74c
--- /dev/null
+++ b/a4mcar/high_level_applications/scripts/process_manipulation/CorePlacer.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+#	Copyright (c) 2017 FH Dortmund.
+#	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
+
+# Places a process given its name to a core
+# Usage: bash CorePlacer.sh <process_name> <core_affinity>
+# ATTENTION! Do not run as root
+
+args=("$@")
+process_name=${args[0]}
+core=${args[1]}  #Affinity, 0-3 for raspberry pi, could be a range too.
+pid=$(pgrep -f $process_name -n ) #Newest result
+
+#Place the task on a specific core.
+sudo taskset -pc $core $pid &&
+echo "Process $process_name with PID=$pid has been placed on core $core"
+
diff --git a/a4mcar/high_level_applications/scripts/process_manipulation/ProcessKill.sh b/a4mcar/high_level_applications/scripts/process_manipulation/ProcessKill.sh
new file mode 100644
index 0000000..cbfae41
--- /dev/null
+++ b/a4mcar/high_level_applications/scripts/process_manipulation/ProcessKill.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+#	Copyright (c) 2017 FH Dortmund.
+#	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
+
+# Kills a process given its name
+# Usage: bash ProcessKill.sh <process_name> 
+# ATTENTION! Do not run as root
+
+args=("$@")
+process_name=${args[0]}
+
+pid=$(pgrep -u root -f $process_name -n ) #Newest result
+
+#Place the task on a specific core.
+sudo kill -9 $pid &&
+echo "Process $process_name with PID=$pid on core has been killed."
+
diff --git a/a4mcar/high_level_applications/scripts/process_manipulation/kill_processes.sh b/a4mcar/high_level_applications/scripts/process_manipulation/kill_processes.sh
new file mode 100644
index 0000000..9a56a4e
--- /dev/null
+++ b/a4mcar/high_level_applications/scripts/process_manipulation/kill_processes.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+#	Copyright (c) 2017 FH Dortmund.
+#	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
+
+# Usage:  bash kill_processes.sh
+#         This script kills the processes listed below
+#
+# ATTENTION: DO NOT RUN THIS SCRIPT AS ROOT
+
+cd /home/pi/a4mcar/high_level_applications/scripts/process_manipulation
+
+bash ProcessKill.sh mjpg_streamer
+bash ProcessKill.sh touchscreen_display
+bash ProcessKill.sh ethernet_client
+bash ProcessKill.sh core_recorder
+bash ProcessKill.sh dummy_load25_1
+bash ProcessKill.sh dummy_load25_2
+bash ProcessKill.sh dummy_load25_3
+bash ProcessKill.sh dummy_load25_4
+bash ProcessKill.sh dummy_load25_5
+bash ProcessKill.sh dummy_load100