blob: b1fff0f3443dc1c17e5e9e51dd9a7623b1fece95 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#!/bin/bash
2#
3# Copyright (c) 2011, Intel Corporation.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004#
Brad Bishopc342db32019-05-15 21:57:59 -04005# SPDX-License-Identifier: GPL-2.0-or-later
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006#
7# DESCRIPTION
8# This script runs BB_CMD (typically building core-image-sato) for all
9# combincations of BB_RANGE and PM_RANGE values. It saves off all the console
10# logs, the buildstats directories, and creates a bb-pm-runtime.dat file which
11# can be used to postprocess the results with a plotting tool, spreadsheet, etc.
12# Before running this script, it is recommended that you pre-download all the
13# necessary sources by performing the BB_CMD once manually. It is also a good
14# idea to disable cron to avoid runtime variations caused by things like the
15# locate process. Be sure to sanitize the dat file prior to post-processing as
16# it may contain error messages or bad runs that should be removed.
17#
18# AUTHORS
19# Darren Hart <dvhart@linux.intel.com>
20#
21
22# The following ranges are appropriate for a 4 core system with 8 logical units
23# Use leading 0s to ensure all digits are the same string length, this results
24# in nice log file names and columnar dat files.
25BB_RANGE="04 05 06 07 08 09 10 11 12 13 14 15 16"
26PM_RANGE="04 05 06 07 08 09 10 11 12 13 14 15 16"
27
28DATADIR="bb-matrix-$$"
29BB_CMD="bitbake core-image-minimal"
30RUNTIME_LOG="$DATADIR/bb-matrix.dat"
31
32# See TIME(1) for a description of the time format parameters
33# The following all report 0: W K r s t w
34TIME_STR="%e %S %U %P %c %w %R %F %M %x"
35
36# Prepare the DATADIR
37mkdir $DATADIR
38if [ $? -ne 0 ]; then
39 echo "Failed to create $DATADIR."
40 exit 1
41fi
42
43# Add a simple header
44echo "BB PM $TIME_STR" > $RUNTIME_LOG
45for BB in $BB_RANGE; do
46 for PM in $PM_RANGE; do
47 RUNDIR="$DATADIR/$BB-$PM-build"
48 mkdir $RUNDIR
49 BB_LOG=$RUNDIR/$BB-$PM-bitbake.log
50 date
51 echo "BB=$BB PM=$PM Logging to $BB_LOG"
52
53 echo -n " Preparing the work directory... "
54 rm -rf pseudodone tmp sstate-cache tmp-eglibc &> /dev/null
55 echo "done"
56
57 # Export the variables under test and run the bitbake command
58 # Strip any leading zeroes before passing to bitbake
59 export BB_NUMBER_THREADS=$(echo $BB | sed 's/^0*//')
60 export PARALLEL_MAKE="-j $(echo $PM | sed 's/^0*//')"
61 /usr/bin/time -f "$BB $PM $TIME_STR" -a -o $RUNTIME_LOG $BB_CMD &> $BB_LOG
62
63 echo " $(tail -n1 $RUNTIME_LOG)"
64 cp -a tmp/buildstats $RUNDIR/$BB-$PM-buildstats
65 done
66done