From: Tom Tromey <tromey@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] rearrange struct value to save memory
Date: Mon, 13 Jan 2014 20:02:00 -0000 [thread overview]
Message-ID: <87sisr1wgu.fsf@fleche.redhat.com> (raw)
In-Reply-To: <52CF6966.1060405@codesourcery.com> (Yao Qi's message of "Fri, 10 Jan 2014 11:30:46 +0800")
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> It does save some memory shown by the result of 'make perf-check' on
Yao> an amd64-linux box. I don't see any time performance regression
Yao> in the test. It is indeed a good improvement!
Yao> Original Patched
Yao> backtrace vmsize 2 55108 54316
Yao> backtrace vmsize 4 55108 52432
Yao> backtrace vmsize 8 53124 51512
[...]
I tried perf-check out on another branch today. I didn't see a canned
way to summarize the results, so I wrote the appended. You'll need a
newish version of prettytable if you don't want the colorizing to mess
up the table.
This is still pretty dumb... I didn't try to deal with graphing or
anything cool like that.
Tom
#!/usr/bin/python
from termcolor import colored
import re
import fileinput
import prettytable
rx = re.compile('^(.*)\s([0-9.]+)$')
# Allow 5% noise.
NOISE = 0.05
results = {}
for line in fileinput.input():
m = rx.match(line)
if m:
name = m.group(1)
value = float(m.group(2))
if name not in results:
results[name] = []
results[name].append(value)
keys = results.keys()
keys.sort()
tab = prettytable.PrettyTable()
for name in keys:
vals = results[name]
newvals = [name, str(vals[0])]
for i in range(1, len(vals)):
perc = abs((vals[i] - vals[i - 1]) / vals[i - 1])
nv = str(vals[i])
if perc > NOISE:
if vals[i] > vals[i - 1]:
nv = colored(nv, 'red')
elif vals[i] < vals[i - 1]:
nv = colored(nv, 'green')
newvals.append(nv)
tab.add_row(newvals)
print tab
next prev parent reply other threads:[~2014-01-13 20:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 19:03 Tom Tromey
2014-01-10 3:32 ` Yao Qi
2014-01-10 17:12 ` Tom Tromey
2014-01-13 20:02 ` Tom Tromey [this message]
2014-01-14 13:50 ` Yao Qi
2014-01-16 21:54 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sisr1wgu.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=yao@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox