blob: 106456584dd66889da2716bffb8e7aa3a9c7deb5 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#!/bin/bash
2#
3# Copyright (c) 2011, Intel Corporation.
4# All rights reserved.
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19#
20# DESCRIPTION
21# This script runs BB_CMD (typically building core-image-sato) for all
22# combincations of BB_RANGE and PM_RANGE values. It saves off all the console
23# logs, the buildstats directories, and creates a bb-pm-runtime.dat file which
24# can be used to postprocess the results with a plotting tool, spreadsheet, etc.
25# Before running this script, it is recommended that you pre-download all the
26# necessary sources by performing the BB_CMD once manually. It is also a good
27# idea to disable cron to avoid runtime variations caused by things like the
28# locate process. Be sure to sanitize the dat file prior to post-processing as
29# it may contain error messages or bad runs that should be removed.
30#
31# AUTHORS
32# Darren Hart <dvhart@linux.intel.com>
33#
34
35# The following ranges are appropriate for a 4 core system with 8 logical units
36# Use leading 0s to ensure all digits are the same string length, this results
37# in nice log file names and columnar dat files.
38BB_RANGE="04 05 06 07 08 09 10 11 12 13 14 15 16"
39PM_RANGE="04 05 06 07 08 09 10 11 12 13 14 15 16"
40
41DATADIR="bb-matrix-$$"
42BB_CMD="bitbake core-image-minimal"
43RUNTIME_LOG="$DATADIR/bb-matrix.dat"
44
45# See TIME(1) for a description of the time format parameters
46# The following all report 0: W K r s t w
47TIME_STR="%e %S %U %P %c %w %R %F %M %x"
48
49# Prepare the DATADIR
50mkdir $DATADIR
51if [ $? -ne 0 ]; then
52 echo "Failed to create $DATADIR."
53 exit 1
54fi
55
56# Add a simple header
57echo "BB PM $TIME_STR" > $RUNTIME_LOG
58for BB in $BB_RANGE; do
59 for PM in $PM_RANGE; do
60 RUNDIR="$DATADIR/$BB-$PM-build"
61 mkdir $RUNDIR
62 BB_LOG=$RUNDIR/$BB-$PM-bitbake.log
63 date
64 echo "BB=$BB PM=$PM Logging to $BB_LOG"
65
66 echo -n " Preparing the work directory... "
67 rm -rf pseudodone tmp sstate-cache tmp-eglibc &> /dev/null
68 echo "done"
69
70 # Export the variables under test and run the bitbake command
71 # Strip any leading zeroes before passing to bitbake
72 export BB_NUMBER_THREADS=$(echo $BB | sed 's/^0*//')
73 export PARALLEL_MAKE="-j $(echo $PM | sed 's/^0*//')"
74 /usr/bin/time -f "$BB $PM $TIME_STR" -a -o $RUNTIME_LOG $BB_CMD &> $BB_LOG
75
76 echo " $(tail -n1 $RUNTIME_LOG)"
77 cp -a tmp/buildstats $RUNDIR/$BB-$PM-buildstats
78 done
79done