From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32309 invoked by alias); 28 Aug 2008 01:40:18 -0000 Received: (qmail 32298 invoked by uid 22791); 28 Aug 2008 01:40:17 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 28 Aug 2008 01:39:38 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 984D898200 for ; Thu, 28 Aug 2008 01:39:36 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 6BE88981F0 for ; Thu, 28 Aug 2008 01:39:36 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1KYWU3-00073t-47 for gdb-patches@sourceware.org; Wed, 27 Aug 2008 21:39:35 -0400 Date: Thu, 28 Aug 2008 01:40:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: Re: RFA: shrink minimal symbols Message-ID: <20080828013935.GA26841@caradoc.them.org> Mail-Followup-To: gdb-patches@sourceware.org References: <20080827205745.GA10837@caradoc.them.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2008-05-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-08/txt/msg00649.txt.bz2 --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 372 On Wed, Aug 27, 2008 at 04:47:02PM -0600, Tom Tromey wrote: > Good point. It does slow things down a bit :( Yeah, unfortunately that was what I suspected. Thanks for checking. I've attached a script I find handy when doing performance work on GDB; the numbers are slightly more reliable this way. I also use 'memusage' from glibc. -- Daniel Jacobowitz CodeSourcery --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=run-and-time Content-length: 4181 #!/usr/bin/python import sys, urllib, htmllib, httplib, ftplib, formatter, urlparse, socket import re, signal, getopt import time, os, resource import stats, string, Scientific.Statistics, Numeric real_times = [] user_times = [] sys_times = [] total_real_times = [] total_user_times = [] total_sys_times = [] def parse_log(filename): global real_times, user_times, sys_times real_times = [] user_times = [] sys_times = [] file = open(filename, "r"); if file: for line in file.readlines(): if line[-1] == '\n': line = line[:-1] words = string.split(line) if(len(words) == 2): if(words[0] == "real"): real_times.append(float(words[1])) if(words[0] == "user"): user_times.append(float(words[1])) if(words[0] == "sys"): sys_times.append(float(words[1])) else: print "Unrecognized line: " + line else: print "Can't open " + filename def parse_log_list(filenames): for file in filenames: parse_log(file) if(len(total_real_times) == 0): total_real_times = real_times total_user_times = user_times total_sys_times = sys_times elif (len(total_real_times) != len(real_times)): print "Ignoring " + file + " - wrong number of times." else: for i in range(len(real_times)): total_real_times[i] += real_times[i] total_user_times[i] += user_times[i] total_sys_times[i] += sys_times[i] def run_once(command): start_real = time.time() rusage = resource.getrusage(resource.RUSAGE_CHILDREN) start_user = rusage.ru_utime start_sys = rusage.ru_stime ret = os.spawnvp(os.P_WAIT, command[0], command) total_real_times.append(time.time() - start_real) rusage = resource.getrusage(resource.RUSAGE_CHILDREN) total_user_times.append(rusage.ru_utime - start_user) total_sys_times.append(rusage.ru_stime - start_sys) if ret > 0: print 'Exited with status %d' % ret elif ret < 0: print 'Exited with signal %d' % -ret def dump_times(): times = [] for i in xrange(niters): times.append((total_real_times[i], total_user_times[i], total_sys_times[i])) times.sort(lambda x, y: cmp(x[0], y[0])) for time in times: print "real %8.5fs user %8.5fs sys %8.5fs" \ % time def run_command(command, niters): for i in xrange(niters): run_once(command) # dump_times() min = 0 for i in xrange(niters): if total_real_times[i] < total_real_times[min]: min = i print "Minimum: real %8.5fs user %8.5fs sys %8.5fs" \ % (total_real_times[min], total_user_times[min], total_sys_times[min]) del total_real_times[min] del total_user_times[min] del total_sys_times[min] max = 0 for i in xrange(niters-1): if total_real_times[i] > total_real_times[max]: max = i print "Maximum: real %8.5fs user %8.5fs sys %8.5fs" \ % (total_real_times[max], total_user_times[max], total_sys_times[max]) del total_real_times[max] del total_user_times[max] del total_sys_times[max] files = False niters = 5 opts, args = getopt.getopt (sys.argv[1:], 'fn:') for pair in opts: if pair[0] == '-f': files = True elif pair[0] == '-n': niters = int(pair[1]) else: sys.exit(1) if (files): parse_log_list(args) else: run_command(args, niters) total_real_times = Numeric.array (total_real_times, Numeric.Float) total_sys_times = Numeric.array (total_sys_times, Numeric.Float) total_user_times = Numeric.array (total_user_times, Numeric.Float) real_average = Scientific.Statistics.average(total_real_times) #real_variance = Scientific.Statistics.variance(total_real_times) real_stddev = Scientific.Statistics.standardDeviation(total_real_times) user_average = Scientific.Statistics.average(total_user_times) #user_variance = Scientific.Statistics.variance(total_user_times) user_stddev = Scientific.Statistics.standardDeviation(total_user_times) sys_average = Scientific.Statistics.average(total_sys_times) #sys_variance = Scientific.Statistics.variance(total_sys_times) sys_stddev = Scientific.Statistics.standardDeviation(total_sys_times) print "Average: real %8.5fs user %8.5fs sys %8.5fs" % (real_average, user_average, sys_average) print "StdDev: real %8.5f user %8.5f sys %8.5f" % (real_stddev, user_stddev, sys_stddev) --9jxsPFA5p3P2qPhR--