Skip to content

Commit d9404e3

Browse files
committed
PMCTrack v0.4
1 parent 84bec6a commit d9404e3

File tree

91 files changed

+4271
-850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+4271
-850
lines changed

bin/pmc-launcher

100644100755
File mode changed.

bin/pmctrack-manager

100644100755
Lines changed: 138 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
action=$1
3-
available_actions=(build version clean build-phi build-user-tools)
3+
available_actions=(build version clean build-phi build-user-tools build-android-odroid)
44

55
if [ "$action" == "" ]; then
66
action_str=$( echo ${available_actions[*]} | tr ' ' '|' )
@@ -520,6 +520,139 @@ function do_build_phi(){
520520
echo "*** BUILD PROCESS COMPLETED SUCCESSFULLY ***"
521521
}
522522

523+
function do_build_android_odroid(){
524+
local bitw=64
525+
local vendor_id=0
526+
local hz_setting=200
527+
local vendor_str="ARM"
528+
local separator="============================================"
529+
local cross_compile="$1"
530+
local kernel_tree="$2"
531+
532+
## Not enough arguments?
533+
if [ "$kernel_tree" == "" ]; then
534+
echo "Usage: pmctrack-manager build-phi <cross_compile> <kernel-sources-dir>"
535+
exit 1
536+
fi
537+
538+
if [ ! -d "${kernel_tree}" ]; then
539+
echo "Linux kernel sources for Android not found: ${kernel_tree} "
540+
exit 1
541+
fi
542+
543+
echo "**** Target system information ***"
544+
printf "Processor_vendor=${vendor_str}"
545+
printf "\n"
546+
echo "Kernel_HZ=${hz_setting}"
547+
echo "Processor_bitwidth=${bitw}"
548+
echo "Cross_compiler=${cross_compile}gcc"
549+
echo "*******************************************************************************************"
550+
printf "Press ENTER to start PMCTrack's cross-compilation for Android on the Odroid-XU4 Board ..."
551+
read
552+
echo "*******************************************************************************************"
553+
554+
oldp=$PWD
555+
556+
## Go to module directory
557+
module=odroid-xu
558+
modname="mchw_odroid_xu.ko"
559+
dir_module="${PMCTRACK_ROOT}/src/modules/pmcs/${module}"
560+
561+
if [ ! -d ${dir_module} ]; then
562+
echo "Module directory not found in the source tree: ${dir_module}"
563+
exit 1
564+
fi
565+
566+
## Go to module directory
567+
cd ${dir_module}
568+
569+
## If the ko already exists (clean it)
570+
if [ -f ${modname} ]; then
571+
echo "Cleaning existing object files for ${modname} module "
572+
make -f Makefile.android XCOMP=${cross_compile} KERNEL_TREE=${kernel_tree} clean
573+
echo "$separator"
574+
fi
575+
576+
echo "Building kernel module $module...."
577+
echo "$separator"
578+
579+
make -f Makefile.android XCOMP=${cross_compile} KERNEL_TREE=${kernel_tree} 2>&1
580+
581+
if [ $? -ne 0 ] ; then
582+
printf "Error building ${modname}\nIncomplete build!!\n"
583+
exit 1
584+
fi
585+
echo "Done!!"
586+
echo "$separator"
587+
588+
cd $oldp
589+
590+
## Build libpmctrack
591+
builddir="${PMCTRACK_ROOT}/src/lib/libpmctrack"
592+
593+
if [ ! -d ${builddir} ]; then
594+
echo "libpmctrack source directory not found in the source tree: ${builddir}"
595+
exit 1
596+
fi
597+
598+
cd $builddir
599+
600+
## If the library files already exist (clean it)
601+
if [ -f libpmctrack.so ] || [ -f libpmctrack.a ]; then
602+
echo "Cleaning up existing object files for libpmctrack"
603+
make clean
604+
echo "$separator"
605+
fi
606+
607+
echo "Building libpmctrack ...."
608+
echo "$separator"
609+
610+
CC=${cross_compile}gcc make ARCH=-DHZ=${hz_setting} 2>&1
611+
612+
if [ $? -ne 0 ] ; then
613+
printf 'Error building libpmctrack\nIncomplete build!!\n'
614+
exit 1
615+
fi
616+
echo "Done!!"
617+
echo "$separator"
618+
## Build pmc-events and pmctrack
619+
620+
for command in pmc-events pmctrack
621+
do
622+
builddir="${PMCTRACK_ROOT}/src/cmdtools/${command}"
623+
execfile="${PMCTRACK_ROOT}/bin/${command}"
624+
if [ ! -d ${builddir} ]; then
625+
echo "${command} source directory not found in the source tree: ${builddir}"
626+
exit 1
627+
fi
628+
629+
cd $builddir
630+
631+
## If the library files already exist (clean it)
632+
if [ -f ${execfile} ] ; then
633+
echo "Cleaning up existing object files for ${command}"
634+
make clean
635+
echo "$separator"
636+
fi
637+
638+
echo "Building ${command} ...."
639+
echo "$separator"
640+
641+
CC=${cross_compile}gcc make 2>&1
642+
643+
if [ $? -ne 0 ] ; then
644+
printf 'Error building ${command}\nIncomplete build!!\n'
645+
exit 1
646+
fi
647+
echo "Done!!"
648+
echo "$separator"
649+
done
650+
651+
echo "*** BUILD PROCESS COMPLETED SUCCESSFULLY ***"
652+
}
653+
654+
655+
523656
case $action in
524657
version) do_version
525658
exit 0
@@ -536,7 +669,10 @@ case $action in
536669
build-user-tools) do_build 1 | tee build_user.log
537670
exit 0
538671
;;
539-
*) echo "Unrecognized action :: $action" >&2
672+
build-android-odroid*) do_build_android_odroid $2 $3
673+
exit 0
674+
;;
675+
*) echo "Unrecognized action :: $action" >&2
540676
exit 1
541677
;;
542678
esac

etc/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2
1+
0.4

src/cmdtools/pmc-events/pmc-events.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <err.h>
3535
#include <pmctrack_internal.h>
3636

37-
/*
37+
/*
3838
* Prints to stdout the list of virtual counters available,
3939
* together with additional comments.
4040
*/
@@ -125,7 +125,7 @@ static void usage(int verbose)
125125
{
126126
printf("Usage: pmc-events [ -h | -v | -I | -L | -V | -n <pmun> | -e <event_string> | -m <processor_model> ]\n");
127127

128-
if(verbose){
128+
if(verbose) {
129129
printf ("\n\t-h\n\t\tDisplays this information about the arguments available");
130130
printf ("\n\t-v\n\t\tShows extra information for some other options");
131131
printf ("\n\t-I\n\t\tDisplays information about the PMU of the processor model");

src/cmdtools/pmctrack/Makefile

100644100755
File mode changed.

0 commit comments

Comments
 (0)