<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic gettin cputime from v$sqlarea in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936233#M762771</link>
    <description>hi all,&lt;BR /&gt;  how can i measure cpu time at any instant from v$sqlarea without using Statspack&lt;BR /&gt;  pls help...its really urgent</description>
    <pubDate>Thu, 01 Feb 2007 02:22:40 GMT</pubDate>
    <dc:creator>Dodo_5</dc:creator>
    <dc:date>2007-02-01T02:22:40Z</dc:date>
    <item>
      <title>gettin cputime from v$sqlarea</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936233#M762771</link>
      <description>hi all,&lt;BR /&gt;  how can i measure cpu time at any instant from v$sqlarea without using Statspack&lt;BR /&gt;  pls help...its really urgent</description>
      <pubDate>Thu, 01 Feb 2007 02:22:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936233#M762771</guid>
      <dc:creator>Dodo_5</dc:creator>
      <dc:date>2007-02-01T02:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: gettin cputime from v$sqlarea</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936234#M762772</link>
      <description>Hy&lt;BR /&gt;&lt;BR /&gt;Check this link:&lt;BR /&gt;&lt;A href="http://www.oracle.com/technology/pub/articles/schumacher_analysis.html" target="_blank"&gt;http://www.oracle.com/technology/pub/articles/schumacher_analysis.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;don't forget to assign points, also in others threads.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 01 Feb 2007 03:25:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936234#M762772</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-02-01T03:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: gettin cputime from v$sqlarea</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936235#M762773</link>
      <description>That's a pretty good link. Thanks.&lt;BR /&gt;&lt;BR /&gt;avik.tcs, You can use statspack. Google and read! You have the power. You can do this!&lt;BR /&gt;&lt;BR /&gt;If still you can not use statspack (privs?) then you should not be (asked to) do this job.&lt;BR /&gt;&lt;BR /&gt;If someone instructs you to do this job anyway, then tell them "fine, but I'll need 'xyz' to accomplish this".&lt;BR /&gt;&lt;BR /&gt;Many other tools exist in this space, notably the oracle enterprise manager.&lt;BR /&gt;Many give nice timelines on resource usage.&lt;BR /&gt;&lt;BR /&gt;The best tool to use, is not yet clear from your question. &lt;BR /&gt;&lt;BR /&gt;What is the real problem you are trying to solve? Please re-read you question and explain it better.&lt;BR /&gt;&lt;BR /&gt;The exact answer to the current question is "0".&lt;BR /&gt;Since an instant is infinitely small, just a point in time, the cpu time at that instant must be zero. Correct?&lt;BR /&gt;&lt;BR /&gt;So you mean something else. Perhaps you want to know the total cpu time used according to oracle during an interval.&lt;BR /&gt;A little like 'vmstat'?&lt;BR /&gt;&lt;BR /&gt;So something needs to loop and wait.&lt;BR /&gt;This can be done in Oracle, but is gets a bit tricky with dbms_lock.sleep perhaps.&lt;BR /&gt;It can be done outside Oracle in a perl or shell script, but it gets a bit expensive to run.&lt;BR /&gt;It can be done in a program executing a cursor ( C, or maybe a perl module ) but that is a little harder and a waste of time not knowing waht you wnat , and possibly not knowing what to do with the result.&lt;BR /&gt;&lt;BR /&gt;So here is a brute force, expensive but working solution for a question you may or might not have asked: How to show the total cpu time used by oracle in a given time interval.&lt;BR /&gt;This (perl) solution takes two arguments: interval_time and repeat_count&lt;BR /&gt;It uses an external sqplplus script which of course can be modified to get other stuff.&lt;BR /&gt;The perl script could get other stuff like system wide cpu time used and roll it all up.&lt;BR /&gt;&lt;BR /&gt;#perl sqlplus_sleep.pl 5 5&lt;BR /&gt;Thu Feb  1 10:19:49 2007 total cpu 36438457, this interval 36438457&lt;BR /&gt;Thu Feb  1 10:19:54 2007 total cpu 36449829, this interval 11372&lt;BR /&gt;Thu Feb  1 10:19:59 2007 total cpu 36470107, this interval 20278&lt;BR /&gt;Thu Feb  1 10:20:05 2007 total cpu 36484245, this interval 14138&lt;BR /&gt;Thu Feb  1 10:20:10 2007 total cpu 36513640, this interval 29395&lt;BR /&gt;&lt;BR /&gt;------------ sqlplus_sleep.pl -----------&lt;BR /&gt;$sleep  = shift;&lt;BR /&gt;$repeat = shift;&lt;BR /&gt;$repeat = 10 unless $repeat;&lt;BR /&gt;$sleep  = 10 unless $repeat;&lt;BR /&gt;while ($repeat--) {&lt;BR /&gt;   @sql_output = qx (sqlplus -S user/pass\@xe \@get_cpu_time.sql);&lt;BR /&gt;   $cpu = $1 if ($sql_output[1] =~ /(\d+)/);&lt;BR /&gt;   $current = $cpu - $last;&lt;BR /&gt;   print  localtime()." total cpu $cpu, this interval $current\n";&lt;BR /&gt;   $last = $cpu;&lt;BR /&gt;   sleep $sleep if $repeat;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;----------------- get_cpu_time.sql ------&lt;BR /&gt;set heading off&lt;BR /&gt;SELECT SUM(cpu_time) from v$sqlarea;&lt;BR /&gt;EXIT;</description>
      <pubDate>Thu, 01 Feb 2007 10:25:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936235#M762773</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-02-01T10:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: gettin cputime from v$sqlarea</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936236#M762774</link>
      <description>thanks for the answer..&lt;BR /&gt;actually i want to measure the cpu time for different sql id running at a time.then i again want to get the same after a certain interval.&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Feb 2007 01:07:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936236#M762774</guid>
      <dc:creator>Dodo_5</dc:creator>
      <dc:date>2007-02-02T01:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: gettin cputime from v$sqlarea</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936237#M762775</link>
      <description>That would only be a minor tweak on the general principle. instead of:&lt;BR /&gt;&lt;BR /&gt;SELECT SUM(cpu_time) from v$sqlarea&lt;BR /&gt;&lt;BR /&gt;try&lt;BR /&gt;&lt;BR /&gt;SELECT cpu_time from v$sqlarea where sql_id = ...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Feb 2007 01:53:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936237#M762775</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-02-02T01:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: gettin cputime from v$sqlarea</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936238#M762776</link>
      <description>hi,,&lt;BR /&gt;&lt;BR /&gt;Bear in mind that the query with the biggest cpu time is not always the WORST query!!&lt;BR /&gt;&lt;BR /&gt;Things that you may need to also look at are: - physical IO&lt;BR /&gt;- logical IO&lt;BR /&gt;&lt;BR /&gt;Also consider the following fact: &lt;BR /&gt;&lt;BR /&gt;query 1,   10000000 cpu seconds&lt;BR /&gt;query 2,   10000000 cpu seconds&lt;BR /&gt;&lt;BR /&gt;and query 1 is executed 10000 times&lt;BR /&gt;and query 2 is executed    10 times&lt;BR /&gt;&lt;BR /&gt;which one do you "fix"?  They both consume tons of cpu!&lt;BR /&gt;&lt;BR /&gt;What would i do?&lt;BR /&gt;1. fix query 1 so as to not execute it so often (algorithm change, probably a programmer doing slow by slow coding instead of set based programing).  &lt;BR /&gt;&lt;BR /&gt;2. fix query 2 to be more efficient&lt;BR /&gt;&lt;BR /&gt;and i would like to fix both. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps too!&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Sat, 03 Feb 2007 00:31:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gettin-cputime-from-v-sqlarea/m-p/3936238#M762776</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2007-02-03T00:31:15Z</dc:date>
    </item>
  </channel>
</rss>

