Skip to content
Snippets Groups Projects
Commit 1f449a09 authored by Bernhard Heinloth's avatar Bernhard Heinloth
Browse files

Improved inject script

parent d0a6bf9b
No related branches found
No related tags found
No related merge requests found
...@@ -34,13 +34,15 @@ struct checkpoint_record *current_cpr_limit; ...@@ -34,13 +34,15 @@ struct checkpoint_record *current_cpr_limit;
int intsight_start_benchmark(size_t reps, size_t checkpoint_capacity) int intsight_start_benchmark(size_t reps, size_t checkpoint_capacity)
{ {
debugfs_remove_recursive(csv_results_folder); if (csv_results_folder) {
BUG_ON(!current_bmr); debugfs_remove_recursive(csv_results_folder);
if (debugfs_vmalloc_cp_matrix) BUG_ON(!current_bmr);
vfree(current_bmr); if (debugfs_vmalloc_cp_matrix)
else vfree(current_bmr);
kfree(current_bmr); else
current_bmr = NULL; kfree(current_bmr);
current_bmr = NULL;
}
BUG_ON(current_bmr); BUG_ON(current_bmr);
const size_t matrix_size = sizeof(struct checkpoint_record) * reps const size_t matrix_size = sizeof(struct checkpoint_record) * reps
......
...@@ -50,7 +50,16 @@ struct checkpoint_record { ...@@ -50,7 +50,16 @@ struct checkpoint_record {
extern struct checkpoint_record *current_cpr; extern struct checkpoint_record *current_cpr;
extern struct checkpoint_record *current_cpr_limit; extern struct checkpoint_record *current_cpr_limit;
static __always_inline void memo_checkpoint(const char *name) #ifdef CONFIG_INTSIGHT_TIMESTAMP_TYPE_TSC
static __always_inline uint64_t memo_get_tsc(void) {
uint64_t a, d;
// TODO rdtscp
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
return (d<<32) | a;
}
#endif
static __always_inline void intsight_checkpoint(const char *name)
{ {
asm volatile("" ::: "memory"); asm volatile("" ::: "memory");
......
inject.sh 100644 → 100755
#!/bin/sh #!/bin/sh
# Add new softirq in interrupt list if [ $# -ne 1 -o ! -d $1 ] ; then
sed -i -e '/ RCU_SOFTIRQ,/a\' -e ' INTSIGHT_SOFTIRQ,' include/linux/interrupt.h echo "Usage: $0 [LinuxFolder]" >&2
elif [ ! -x "$(command -v spatch)" ] ; then
echo "Command 'spatch' not available - please install Coccinelle!" >&2
elif [ -f "$1/.intsight" ] ; then
echo "Folder '$1' is already patched!" >&2
exit 1
else
echo "Injecting INTsight"
touch "$1/.intsight"
echo " - copying files..."
cp -r arch "$1"
cp -r include "$1"
echo " - adding to KConfig..."
sed -i -e '/endmenu/i source "arch/arm/intsight/Kconfig"\' -e '' "$1/arch/arm/Kconfig.debug"
sed -i -e '/endmenu/i source "arch/x86/intsight/Kconfig"\' -e '' "$1/arch/x86/Kconfig.debug"
# Add to KConfig echo " - adding to Makefile..."
sed -i -e '/endmenu/i source "arch/arm/intsight/Kconfig"\' -e '' arch/arm/Kconfig.debug echo '\n\ncore-y += arch/arm/intsight/' >> "$1/arch/arm/Makefile"
echo '\n\ncore-y += arch/x86/intsight/' >> "$1/arch/x86/Makefile"
echo " - adding new softirq to interrupt list"
sed -i -e '/ RCU_SOFTIRQ,/a\' -e ' INTSIGHT_SOFTIRQ,' "$1/include/linux/interrupt.h"
# Add to Makefile PATCHFILE="$1/intsight.patch"
echo -e '\n\ncore-y += arch/arm/intsight/' >> arch/arm/Makefile if [ ! -f "$PATCHFILE" ] ; then
echo " - allocating checkpoints (with coccinelle)"
#TODO: Copy Files spatch --sp-file checkpoints.cocci --dir "$1" | tee "$PATCHFILE"
else
# Patch files (use find) echo " - (found checkpoint patch file)"
# for i in /opt/heinloth/linux-at91-bachelorarbeit/drivers/irqchip/*.c ; do spatch --sp-file checkpoints.cocci $i fi
\ No newline at end of file echo " - patching checkpoints"
patch -p1 -d"$1" < "$PATCHFILE"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment