Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1604 > unrolled thread
| Started by | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| First post | 2013-08-29 23:37 -0700 |
| Last post | 2013-09-27 07:36 -0700 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.lang.postscript
How do you profile postscript code? luser- -droog <mijoryx@yahoo.com> - 2013-08-29 23:37 -0700
Re: How do you profile postscript code? luser- -droog <mijoryx@yahoo.com> - 2013-08-31 17:55 -0700
Re: How do you profile postscript code? luser- -droog <mijoryx@yahoo.com> - 2013-09-12 09:40 -0700
Re: How do you profile postscript code? John Deubert <john@acumentraining.com> - 2013-09-27 07:36 -0700
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2013-08-29 23:37 -0700 |
| Subject | How do you profile postscript code? |
| Message-ID | <c0ac5848-bb8f-4364-8283-6a5abc3327a3@googlegroups.com> |
I posted a sorting function a few days ago. And a few others followed. I think it'd be fun to run these against each other. But what little profiling I've done has been on C code with the help of gprof, which is pretty automatic. I've read about how to do it, of course. You want to do lots of reps to "fly over the bumps" of system-load issues. PS offers `usertime` and `realtime`. In my experience, the numbers reported by ghostscript's usertime weren't what I expected (though I don't remember the details). So, anybody know how to do it with postscript?
[toc] | [next] | [standalone]
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2013-08-31 17:55 -0700 |
| Message-ID | <46233cf1-709a-4fc0-b1c1-0bf07d2750c8@googlegroups.com> |
| In reply to | #1604 |
On Friday, August 30, 2013 1:37:08 AM UTC-5, luser- -droog wrote:
> I posted a sorting function a few days ago. And a few others followed.
> I think it'd be fun to run these against each other. But what little
> profiling I've done has been on C code with the help of gprof, which is
> pretty automatic. I've read about how to do it, of course. You want to
> do lots of reps to "fly over the bumps" of system-load issues.
>
> PS offers `usertime` and `realtime`. In my experience, the numbers reported
> by ghostscript's usertime weren't what I expected (though I don't remember
> the details).
>
> So, anybody know how to do it with postscript?
Well, here's a beginning. This code can count invocations of operators.
%!
/logdict 1 dict def
/countname { %name
logdict 1 index known {
logdict exch
logdict 1 index get
1 add put
}{
logdict exch 1 put
} ifelse
} bind def
/logname { %name
logdict 1 index 0 put
[ 1 index /countname cvx 1 index load
dup xcheck 1 index type /arraytype eq and
{ /exec cvx } if
] cvx def
} bind def
1 dict begin
/add logname
/sub logname
/mul logname
/div logname
0 [ 0 1 20{}for ] { add } forall
[ 1 1 5{}for ] { mul } forall
[ 23 -2 4{}for ] { sub } forall
1 1 add
div =
logdict { exch =only( )=only == } forall
%eof
Output:
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
12530.0
add 22
sub 10
mul 5
div 1
GS>
[toc] | [prev] | [next] | [standalone]
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2013-09-12 09:40 -0700 |
| Message-ID | <d647088f-88d5-4a19-ae96-257e04642f05@googlegroups.com> |
| In reply to | #1604 |
On Friday, August 30, 2013 1:37:08 AM UTC-5, luser- -droog wrote: > I posted a sorting function a few days ago. And a few others followed. > I think it'd be fun to run these against each other. But what little > profiling I've done has been on C code with the help of gprof, which is > pretty automatic. I've read about how to do it, of course. You want to > do lots of reps to "fly over the bumps" of system-load issues. > > PS offers `usertime` and `realtime`. In my experience, the numbers reported > by ghostscript's usertime weren't what I expected (though I don't remember > the details). > > So, anybody know how to do it with postscript? Found this guide to profiling: http://movementarian.org/linux-profiling/index.html
[toc] | [prev] | [next] | [standalone]
| From | John Deubert <john@acumentraining.com> |
|---|---|
| Date | 2013-09-27 07:36 -0700 |
| Message-ID | <201309270736543160-john@acumentrainingcom> |
| In reply to | #1604 |
On 2013-08-30 06:37:08 +0000, luser- -droog said: > I posted a sorting function a few days ago. And a few others followed. > I think it'd be fun to run these against each other. But what little > profiling I've done has been on C code with the help of gprof, which is > pretty automatic. I've read about how to do it, of course. You want to > do lots of reps to "fly over the bumps" of system-load issues. > > PS offers `usertime` and `realtime`. In my experience, the numbers reported > by ghostscript's usertime weren't what I expected (though I don't remember > the details). > > So, anybody know how to do it with postscript? The May 2003 issue of the Acumen Journal (#25) describes the implementation of a PostScript profiler; the article's title is "A PostScript Profiler (Sort of)." The Journal is free for the downloading at www.http://acumentraining.com/acumenjournal.html Hope that helps. - John -- ======== John Deubert Acumen Training PostScript & PDF Engineering Classes & Consulting www.acumentraining.com Learn PostScript programming techniques Read the free Acumen Journal acumentraining.com/acumenjournal.html
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.postscript
csiph-web