Browse Source

Clifford Wolf:


			
			
				rocklinux
			
			
		
Clifford Wolf 17 years ago
parent
commit
4f94cb2b27
5 changed files with 56 additions and 19 deletions
  1. +22
    -6
      misc/tools-source/bash_profiler.c
  2. +0
    -1
      misc/tools-source/config_helper.c
  3. +9
    -12
      scripts/Config
  4. +2
    -0
      scripts/config.func
  5. +23
    -0
      scripts/config.in

+ 22
- 6
misc/tools-source/bash_profiler.c

@ -59,7 +59,8 @@ struct bprofent;
struct bprofent {
char *id;
int count;
int recursive;
int count, running;
long long tv_sum, tv_start;
struct bprofent *next;
};
@ -81,8 +82,13 @@ int bprof_builtin(WORD_LIST *list)
if ( !strcmp(mode, "print") && !strcmp(name, "all") ) {
while ( this ) {
printf("%7d %7Ld %10.3f %s\n", this->count, this->tv_sum,
printf("%7d %7Ld %10.3f %s", this->count, this->tv_sum,
(float)this->tv_sum/this->count, this->id);
if (this->running)
printf(" (active)");
if (this->recursive)
printf(" (recursive)");
printf("\n");
this = this->next;
}
return 0;
@ -101,13 +107,23 @@ int bprof_builtin(WORD_LIST *list)
}
if ( !strcmp(mode, "start") ) {
this->tv_start = mytime();
if (this->running++ == 0)
this->tv_start = mytime();
if (this->running > 1)
this->recursive = 1;
} else if ( !strcmp(mode, "stop") ) {
this->tv_sum += mytime() - this->tv_start;
this->count++;
if (--this->running == 0) {
this->tv_sum += mytime() - this->tv_start;
this->count++;
}
} else if ( !strcmp(mode, "print") ) {
printf("%7d %7Ld %10.3f %s\n", this->count, this->tv_sum,
printf("%7d %7Ld %10.3f %s", this->count, this->tv_sum,
(float)this->tv_sum/this->count, this->id);
if (this->running)
printf(" (active)");
if (this->recursive)
printf(" (recursive)");
printf("\n");
}
return 0;

+ 0
- 1
misc/tools-source/config_helper.c

@ -276,7 +276,6 @@ int pkgswitch(int mode, char **args)
int pkgfork(char *pkgname, char *xpkg, char** opt)
{
struct package *fork, *pkg;
int i, k;

+ 9
- 12
scripts/Config

@ -114,19 +114,10 @@ else
echo "Building src/bash_profiler.so."
gcc -shared -fPIC -Wall -o src/bash_profiler.so misc/tools-source/bash_profiler.c || exit 1
fi
rm -f config.profile
enable -f src/bash_profiler.so bprof || exit 1
bprof_print() {
bprof all print >> config.profile
awk '
$4 == "profiled" { next; }
$4 != "main" { count["profiled"]+=$1; time["profiled"]+=$2; }
{ count[$4]+=$1; time[$4]+=$2; }
END {
for (id in count)
printf "%7d %7Ld %10.3f %s\n", count[id], time[id], time[id]/count[id], id;
}
' < config.profile | sort -n -k2 > config.profile.new
mv config.profile{.new,}
{ echo "--- `date` ---"; bprof all print | sort -k2; } >> config.profile
}
fi
@ -286,8 +277,10 @@ while [ "$do_config_cycle" == 1 ] ; do
esac
done
bprof main stop
bprof_print
done
bprof finish start
pkgout
rm -f $swpdir/*.tmp
@ -315,3 +308,7 @@ for x in $( ls config/$config ); do
[ -e $swpdir/$x ] || rm -f config/$config/$x
done
rm -rf $swpdir
bprof finish stop
bprof_print

+ 2
- 0
scripts/config.func

@ -189,6 +189,8 @@ else
local pkg=$1 xpkg=$2 extraver ; shift 2
bprof pkgfork start
# >50% of the Config time is spent in this line!
parse_desc package/*/$pkg/$pkg.desc P V
extraver=$( echo $desc_V 0 | cut -f2 -d" " )

+ 23
- 0
scripts/config.in

@ -72,6 +72,8 @@
unset ${!CFGTEMP_*}
bprof rockconfig_preconfig start
if [ ! -e "$swpdir/preconfig.in.tmp" ] ; then
grep -h -v "^#" architecture/*/preconfig.in \
misc/*/preconfig.in \
@ -81,6 +83,9 @@ if [ ! -e "$swpdir/preconfig.in.tmp" ] ; then
fi
include "$swpdir/preconfig.in.tmp"
bprof rockconfig_preconfig stop
bprof rockconfig_arch start
comment_id '- Architecture, CPU and Optimization' COMMENT_ARCHCPUOPT
block_begin 7
@ -124,6 +129,9 @@ block_begin 7
fi
block_end
bprof rockconfig_arch stop
bprof rockconfig_target start
comment ' '
comment_id '- Target Distribution' COMMENT_TARGET
@ -137,6 +145,9 @@ block_begin 7
bool 'Abbreviate ROCK Config ID with checksum' ROCKCFG_IDCKSUM 0
block_end
bprof rockconfig_target stop
bprof rockconfig_buildsys start
comment ' '
comment_id '- Build System Configuration' COMMENT_BUILD_SYS_CONF
block_begin 3
@ -194,8 +205,14 @@ block_begin 3
expert_end
block_end
bprof rockconfig_buildsys stop
bprof rockconfig_noexpert start
include "misc/*/noexpertconfig.in"
bprof rockconfig_noexpert stop
bprof rockconfig_expert start
expert_begin
comment ' '
comment '- Binary package format'
@ -258,6 +275,9 @@ fi
include "$swpdir/config.in.tmp"
expert_end
bprof rockconfig_expert stop
bprof rockconfig_postconfig start
[ "$ROCKCFG_CROSSBUILD" = 1 ] && ROCKCFG_ID="$ROCKCFG_ID-cross"
[ "$ROCKCFG_PSEUDONATIVE" = 1 ] && ROCKCFG_ID="$ROCKCFG_ID-pseudonative"
ROCKCFG_ID="$ROCKCFG_ID-$ROCKCFG_TARGET"
@ -309,3 +329,6 @@ fi
var_append filterscript ' ' '/^[XO] --* / d ;'
pkgfilter sed -e "$filterscript"
bprof rockconfig_postconfig stop

Loading…
Cancel
Save