<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1018121" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1018121</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/use-benchmarkpm#comment-1106356</link>
    <description> &lt;p&gt;Yes. IMO, the module should output an array or a hashref of numbers so you can pick and choose how to format the output. Hardcoding the output in a print statement is very weak. It would be far more flexible to output into a hashref that could be incorporated into a database or another program.&lt;/p&gt;
 </description>
     <pubDate>Mon, 08 Apr 2002 10:33:06 +0000</pubDate>
 <dc:creator>Wil</dc:creator>
 <guid isPermaLink="false">comment 1106356 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/use-benchmarkpm#comment-1106349</link>
    <description> &lt;p&gt;do i understand you right:&lt;br /&gt;
you don&#039;t really understand, why the module-author is using a defined output like 1 wallclock-secs (..usr + ..sys).......? i was quite surprised too. wouldn&#039;t a normal thing just put out some numbers? and that is what you are doing in your code sample?&lt;br /&gt;
i&#039;m a little bit puzzled at this point. ???&lt;/p&gt;
 </description>
     <pubDate>Mon, 08 Apr 2002 08:45:38 +0000</pubDate>
 <dc:creator>merlin</dc:creator>
 <guid isPermaLink="false">comment 1106349 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/use-benchmarkpm#comment-1106345</link>
    <description> &lt;p&gt;I&#039;m glad you had a good time! While you&#039;ve been away, I&#039;ve been thinking...&lt;/p&gt;
&lt;p&gt;Here is another method, a very generic method and a method which is not very efficient.&lt;/p&gt;
&lt;p&gt;Short of modifying Benchmark.pm to produce usable results as a data return rather than a mixture of prints along with variable, hash, and array reference returns, depending onwhich functions are called, it is possible to redirect Standard Output to an alias filehandle then later restore Standard Output to a console.&lt;/p&gt;
&lt;p&gt;This is not difficult to do and affords some options. However, as said, this is not all that efficient. Nonetheless, this would allow all functions in Benchmark to be employed while suppressing printing to a console; portability is had.&lt;/p&gt;
&lt;p&gt;A trade-off is having to write code which will parse returns per Benchmark function called; printed results vary greatly.&lt;/p&gt;
&lt;p&gt;My test script shows one method of a number of methods. This simply redirects Standard Output to a file, which could be a temporary file later unlinked. Results are printed to a file rather than a console. Parsing of this file would yield only those results of interest.&lt;/p&gt;
&lt;p&gt;For my example I include a print command for the &quot;CPU&quot; element of an array reference returned by Benchmark. You will note this is actually duplicated; once by Benchmark&#039;s printing  and again by my syntax. It would be just as easy to leave out my array reference print and parse general returns; this affords a wide selection of desired output to be printed and affords all Benchmark functions to be employed and printed.&lt;/p&gt;
&lt;p&gt;It is clear this problem of module authors mixing prints to Standard Output with pure variable returns, is a nuisance. Logic dictates a good module writer would provide options as to how returns are presented; console versus variables.&lt;/p&gt;
&lt;p&gt;Personally, I would write a custom benchmark module which produces returns as I need, as a variable or an array, both of which could be easily accessed, should this become important.&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;#!perl&lt;br /&gt;&lt;br /&gt;print &amp;quot;Content-type: text/plain\n\n&amp;quot;;&lt;br /&gt;&lt;br /&gt;use Benchmark;&lt;br /&gt;&lt;br /&gt;open(REDIRECT, &amp;quot;&amp;gt;&amp;amp;STDOUT&amp;quot;);&lt;br /&gt;open(STDOUT, &amp;quot;&amp;gt;test.txt&amp;quot;) or die &amp;quot;Standard Output Redirect Failed: $!&amp;quot;;&lt;br /&gt;&lt;br /&gt;$results = timethese (1000000,&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;#039;Test_One&amp;#039; =&amp;gt;&lt;br /&gt;&amp;#039;$variable_one = &amp;quot;variable one&amp;quot;;&amp;#039;,&lt;br /&gt;&amp;nbsp; } );&lt;br /&gt;&lt;br /&gt;foreach $key ( keys %$results )&lt;br /&gt;{ print &amp;quot;CPU $results-&amp;gt;{$key}[1]&amp;quot;; }&lt;br /&gt;&lt;br /&gt;close(STDOUT) or die &amp;quot;Standard Out Closure Failed: $!&amp;quot;;&lt;br /&gt;&lt;br /&gt;open(STDOUT, &amp;quot;&amp;gt;&amp;amp;REDIRECT&amp;quot;) or die &amp;quot;Standard Output Restoration Failed: $!&amp;quot;;&lt;br /&gt;&lt;br /&gt;close (REDIRECT) or die &amp;quot;Redirect Closure Failed: $!&amp;quot;;&lt;br /&gt;&lt;br /&gt;open (RESULTS, &amp;quot;test.txt&amp;quot;) or die &amp;quot;Open Of Data Results Failed: $!&amp;quot;;&lt;br /&gt;&lt;br /&gt;while (&amp;lt;RESULTS&amp;gt;)&lt;br /&gt; {&lt;br /&gt;&amp;nbsp; if (index ($_, &amp;quot;CPU&amp;quot;) == 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp; { print $_; }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;close (RESULTS) or die &amp;quot;Results Closure Failed: $!&amp;quot;;&lt;br /&gt;&lt;br /&gt;exit;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;TEST.TXT PRINTED RESULTS:&lt;br /&gt;_________________________&lt;br /&gt;&lt;br /&gt;Benchmark: timing 1000000 iterations of Test_One...&lt;br /&gt;&amp;nbsp; Test_One:&amp;nbsp; 1 wallclock secs ( 0.61 usr +&amp;nbsp; 0.00 sys =&amp;nbsp; 0.61 CPU) @ 1639344.26/s (n=1000000)&lt;br /&gt;CPU 0.61&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CONSOLE PRINTED RESULTS:&lt;br /&gt;________________&lt;br /&gt;&lt;br /&gt;CPU 0.61&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;I hope this helps!&lt;/p&gt;
 </description>
     <pubDate>Mon, 08 Apr 2002 08:31:11 +0000</pubDate>
 <dc:creator>Wil</dc:creator>
 <guid isPermaLink="false">comment 1106345 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/use-benchmarkpm#comment-1106343</link>
    <description> &lt;p&gt;yeah, last snow. the very very last snow. i went to &lt;a href=&quot;http://www.arosa.ch&quot; class=&quot;bb-url&quot;&gt;arosa, switzerland&lt;/a&gt;, quite nice there. &lt;/p&gt;
&lt;p&gt;back to the topic.&lt;br /&gt;
it worked fine, but you should use &lt;em&gt;chop&lt;/em&gt; instead of &lt;em&gt;chomp&lt;/em&gt; to delete the last sign. now i have what i was looking for but i&#039;m thinking of going even further:&lt;br /&gt;
saving the data into a file to build a kind of statitics of the access-rate. but i will think of that and if i&#039;m encountering any difficulties i feel free to post them here... &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;thank you!!&lt;/p&gt;
 </description>
     <pubDate>Mon, 08 Apr 2002 07:49:29 +0000</pubDate>
 <dc:creator>merlin</dc:creator>
 <guid isPermaLink="false">comment 1106343 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/use-benchmarkpm#comment-1106102</link>
    <description> &lt;p&gt;Cool! I&#039;ve just come back from Courcheval, south France. Where you heading? You going for the &#039;last snow&#039;, huh?! Have fun!&lt;/p&gt;
 </description>
     <pubDate>Thu, 04 Apr 2002 15:43:49 +0000</pubDate>
 <dc:creator>Wil</dc:creator>
 <guid isPermaLink="false">comment 1106102 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/use-benchmarkpm#comment-1106101</link>
    <description> &lt;p&gt;i will check your suggestion on monday, i&#039;m going to the mountains, snowboarding now. thanks!&lt;/p&gt;
 </description>
     <pubDate>Thu, 04 Apr 2002 14:43:40 +0000</pubDate>
 <dc:creator>merlin</dc:creator>
 <guid isPermaLink="false">comment 1106101 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/use-benchmarkpm#comment-1106085</link>
    <description> &lt;p&gt;If that doesn&#039;t work for you; I&#039;ve thought of a rather long-winded way of supressing the output of benchmark.pm instead of using another script.&lt;/p&gt;
&lt;p&gt;Let me know how it goes.&lt;/p&gt;
 </description>
     <pubDate>Thu, 04 Apr 2002 08:15:56 +0000</pubDate>
 <dc:creator>Wil</dc:creator>
 <guid isPermaLink="false">comment 1106085 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/use-benchmarkpm#comment-1106084</link>
    <description> &lt;p&gt;Interesting. The way I would do this using another script in Perl to format the results would look something like this:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;chomp($output);&lt;br /&gt;($junk,$cpu_time) = split (/\=/, $output);&lt;br /&gt;&lt;br /&gt;print $output;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Thu, 04 Apr 2002 08:15:23 +0000</pubDate>
 <dc:creator>Wil</dc:creator>
 <guid isPermaLink="false">comment 1106084 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/use-benchmarkpm#comment-1106027</link>
    <description> &lt;p&gt;my output is:&lt;br /&gt;
&lt;code&gt;1 wallclock secs (0.26 usr + 0.00 sys = 0.26 CPU)&lt;/code&gt;&#039;&lt;/p&gt;
&lt;p&gt;thank you Wil for your help, i&#039;m really glad &#039;bout it!!&lt;/p&gt;
 </description>
     <pubDate>Wed, 03 Apr 2002 12:14:46 +0000</pubDate>
 <dc:creator>merlin</dc:creator>
 <guid isPermaLink="false">comment 1106027 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/use-benchmarkpm#comment-1106023</link>
    <description> &lt;p&gt;Um. There&#039;s no way to format the output by default, but a quick hack would do it. Can you give me an example of the output and I&#039;ll see if I can write a regex to extract only the CPU usage.&lt;/p&gt;
 </description>
     <pubDate>Wed, 03 Apr 2002 08:45:38 +0000</pubDate>
 <dc:creator>Wil</dc:creator>
 <guid isPermaLink="false">comment 1106023 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
