Time taken to to execute a method

Hi,
I have a method which reads a large file. Is it possible to get the time which needs to execute this method and to get elapsed time while reading the file.
Thanks a lot,
Chamal.

Example:
private long time; // me love you
public static void main(String[] mufflewumps)
    startTime();
    new someClass().someLongMethod();
    showElapsedTime();
private void startTime()
    time = System.currentTimeMillis();
private void showElapsedTime()
    System.out.println("someLongMethod() elapsed time: " + (System.currentTimeMillis - time));

Similar Messages

  • How to identify time taken to execute a package

    Hi all,
    Is the method without TKPROFF to find the time taken to execute a package that calls a procedure.
    for examples
    Lets says I execute a packaage at SQLplus window
    SQL> Execute my_pack.bal_proc;
    (It took some time may be 4 hrs to excecute according to my watch).
    At this stage if I want to find the time by some sql command that after executing the package what was the time.
    can someone help me in finding a query that tell what was the time taken to execute a package.
    thanks n rgds
    saaz

    You can check start and end time
    Then end time -start time
    SQL> select systimestamp start_time from dual;
    START_TIME
    11-AUG-09 11.30.47.758282 AM -04:00
    SQL> Execute my_pack.bal_proc;
    SQL> select systimestamp end_time from dual;
    END_TIME
    11-AUG-09 11.31.11.207530 AM -04:00Edited by: user5495111 on Aug 11, 2009 8:32 AM

  • Time taken to execute code vs time taken to render to screen....

    Hello Experts,
    I noticed something strange while debugging some of my code.
    I have a for loop in which I'm creating and adding node elements. Above the for loop I'm creating a modal window, and after the for loop I'm destroying the modal window. In the modal window I have a timedtrigger element with a delay of one second.
    Here is the pseudocode:
    createModalWindow();
    for(int i=0; i<200; i++)
        // create and add node elements
    destroyModalWindow();
    Inside the modal windows wdDoInit() method I enable the timedTrigger, inside the wdDoExit() method, I disable the timedTrigger.
    When I execute this code I get a null pointer exception because the application is trying to destroy a window instance that doesn't exist!!! ie the modal window. When I comment out the destroyModalWindow() line, I noticed that the modal window get rendered after the loop has finished its processing not before like I'd expect. Could this mean the line destroyModalWindow(); is being called too early? Once the loop has processed there might be some clinet / server delay?? Another thing I noticed was the timed trigger event, even though its set to a 1 second delay, takes about 6 seconds on a round trip from the client to Web Application Server!!!! So even though on the WAS its processing it every second, it takes almost 6-7 seconds for it to render on the client browser!
    Has anyone else noticed this delay in rendering to code execution? Is it possible the Web Dynpro may terminate earlier than expected or sometimes we might not even see the results because time taken to render is slower than time taken to process request?
    What are peoples' thoughts?
    MM

    Sorry if I misinterpret your question...
    Remember Web Dynpro is server side technology. So no actual rendering happens at all until all code has been executed, then wdDoModify is called, and then output is generated and sent to the browser for rendering. Of course I can't see your code in it's completion, but the modal window should never display under any circumstances, as the call to create() and then destroy() happen within the same execution cycle, from what I can tell of your snippet.

  • Time taken for a method to run. ?

    I have a query regarding ascertaining the time taken
    for a method to execute
    I have a SQL statement that I reads 10,000 rows.
    String a_SQL = "Select.....from TableA";
    try {
         IQuery query = m_UC.createQuery();
         SimpleTableModel stm = query.executeSelect(a_SQL);
       }catch(SQLException se){
       // Query Over.
       private void displayJTable(){
       // display rows read from the query above.
       }          As the query is executing,I want to display a progress bar
    showing the status of the query.
    Now I cant use this :
    start = System.currentTimeMillis();
    try {
         IQuery query = m_UC.createQuery();
         SimpleTableModel stm = query.executeSelect(a_SQL);
       }catch(SQLException se){
    end = System.currentTimeMillis();
    System.out.println(" Time taken  to display " + (end - start)/1000);
                  The above will give me the time elapsed in seconds for the SQL query to execute,but
    this is not what I want.
    What i want is to use this :
           // Progress BAR executing,so I need to get to know the time
           // taken for the query to run
            try {
            the SQL execution
            }cach(){
            // Query over.
            // Stop Progres Bar.
            // Display JTable.       How can I know when to stop the Progress Bar as I have no handle
    on the time taken to execute the query?
    Any help will be appreciated

    You can have a separate thread (or maybe it's just part of the regular GUI update thread? I don't know details about GUIs) that puts up an hourglass or spinning clock hands or dancing hamster or whatever to indicate that something is going on, but like the man says, you can't know ahead of time how long it will take to run a query, so you can't show percent done. You also don't in general know ahead of time how many rows will be returned so that doesn't help you.
    You might be able to do something for the processing of the returned data, once the query completes, because then you can often get a count of the number of rows, so you process each row in a loop, and update the % done counter each time through the loop.

  • How can I execute a method on a specified time?

    How can I execute a method on a specified time such as method1() will be executed on 1:00 p.m and the method2() will be executed in 1:00 a.m?

    BilgeTonyukuk99 wrote:
    How can I execute a method on a specified time such as method1() will be executed on 1:00 p.m and the method2() will be executed in 1:00 a.m?As a simple example, take a look at http://www.javapractices.com/topic/TopicAction.do?Id=54.
    As an alternative (and looks like better approach), you could use the ScheduledThreadPoolExecutor.

  • Time taken to execute my report?

    Hi Expects,
    I want to print in the output how much time taken to execute my report. Please help on this.
    regards,
    vijay

    Hi vijay,
    1. simple
    2. we have to use two things to get Current time.
       GET TIME
       SY-UZEIT.
    3.
    report abc.
    data : t1 type sy-uzeit.
    data : t2 type sy-uzeit.
    data : diff type i.
    data : ekko like table of ekko with header line.
    get time.
    t1 = sy-uzeit.
    select * from ekko into table ekko.
    select * from ekko into table ekko.
    get time.
    t2 = sy-uzeit.
    write :/ t1.
    write :/ t2.
    diff = t2 - t1.
    write :/ 'Time Taken : ' , diff.
    regards,
    amit m.

  • TIme taken to execute query

    Hi,
    HOW TO FIND OUT TIME TAKEN TO EXECUTE SELECT QUERY IN SAP, SAY FOR EXAMPLE
    SELECT * FROM MARA WHERE MATNR BETWEEN '100' AND '1000'.
    HOW TO PRINT TIME TAKEN TO EXECUTE ABOVE QUERY i.e. TIME IN MICROSECONDS...
    IF YOU HAVE SAMPLE PROGRAM THEN PLEASE LET ME KNOW.
    THANKS,
    JOHN.

    just declare.
    END-OF-SELECTION.
      GET TIME.
      end_dt = sy-datum.
      end_tm = sy-uzeit.
    <b>ex--</b>
    select * from ekko into table ekko.
    get time.
    t1 = sy-uzeit.
    select * from ekko into table ekko.
    get time.
    t2 = sy-uzeit.
    write :/ t1.
    write :/ t2.
    diff = t2 - t1.
    write :/ 'Time Taken : ' , diff.

  • Time take to execute each method

    is it possible to find the time take to execute each method using jdeveloper profiler. Are there any tutorials that tells you how to do this.
    Thanks in advance

    Sorry, we have yet to make one available, but the tutorial provided should act as good starting point even you are dealing with different versions.
    --RiC                                                                                                                                                                                                                                                                                                                       

  • How to show the processing time taken for a BPEL process in BAM report.

    Hi All,
    I have the data as below in the Data object. I would like to show the time taken for each order to complete in the report.
    instance Id     order Id     product Name     product Code     price     status     instance Time      updaterName
    1360010     ord004     Guitar     prod003     2000     requested     9/22/2008 12:12:11 PM     Invoke_InsertSalesOrder
    1360010     ord004     Guitar     prod003     2000     Approved     9/22/2008 12:15:11 PM     Invoke_OrderStatusUpdate
    This data comes from simple BPEL process where sensors are configured at the start and end of BPEL process. Also have a human task activity in between to create the time difference.
    In Enterprise link design studio, I tried to calculate the time difference using expression calculator and store it as calculated field. But that doesn't seems to work because when I execute the plan, second sensor data reaches only after human approval whereas first sensor data would be waiting for calculation and ultimately nothing comes into data object.
    How and where the calculation be done to show the processing time in the report. Please someone throw some light on this.
    Regards
    Jude.
    Edited by: user600726 on Sep 30, 2008 1:30 AM

    I would suggest modifying your data object so that the data can all be in a single row and use the sensor at the end of the process to upsert (update) the row created by the sensor at the start of the process. The time difference between two fields in the same row is then an easy calculation on a BAM report -- No EL plan should be needed.

  • Query Execution time - Elapsed time v Actual time taken

    Hi All,
    I have this scenario where I am querying a single table with the following results. It is a very heavy query in that there are multiple aggregate functions and multiple unions on it. Even if the query is written poorly (i doubt it is) why would the actual
    time taken to execute the query be much more than the statistics provided through the following commands?
    SET STATISTICS IO ON;
    SET STATISTICS TIME ON;
    Attached are the stats provided for the relevant query in question.
    Table '123456789_TEMP_DATA'. Scan count 178, logical reads 582048, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    SQL Server Execution Times:
       CPU time = 936 ms,  elapsed time = 967 ms.
    2014-01-06 17:36:41.383
    Now, although the CPU Time/Elapsed time shows that it takes less than a second, it actually takes more than 15 seconds to fetch the results. (This is the actual time that you get on the bottom bar of the Query pane as well.)
    What is the reason? Why is it that there is such a big discrepancy between the numbers? How can I improve this situation?
    Thanks!

    Yes. I am returning a huge number of rows to the client. 
    The query is simply against a single table. 
    Select
     'First Record',AVG(COLUMN1),STDEV(COLUMN1
    ),COUNT(COLUMN1)
    FROM [TABLE1] WHERE (SOME CONDITION)
    UNION ALL
    Select  'Second Record',AVG(COLUMN2),STDEV(COLUMN2),COUNT(COLUMN2) FROM [TABLE1]
    WHERE (SOME OTHER CONDITION)
    Imagine there are 178 records fetched in this manner with 178 UNIONs. The WHERE clause will always change for each SELECT statement.
    Now, the question is not so much about the query itself, but why the execution time is actually 15 seconds whilst the SQL STATISTICS show it to be 936ms (<1 second)
    Thanks!

  • Time taken in each section of Mapping

    Hi All,
    One of my mappings is taking a very long to execute in production db. Is there anyway/ any table which lets me view the times taken for each step in the mapping?
    I tried to use Debug mode by opening the mapping in OWB but the debug mode is a lot slower than the mapping itself when deployed - hence i am not able to know accurately where the actual problem might be.
    thanks.

    Hi
    The OWB browser has runtime reports that will let you see the steps and timings.
    There are a bunch of reports in the blog here on the runtime audit tables that you can use in SQLDeveloper, or just rip off the SQL;
    http://blogs.oracle.com/warehousebuilder/2010/10/owb_sql_reports_in_code_samples.html
    Download the zip, either use SQLDev with the reports or take the file OWBReports.xml and look at the SQL in it and use wherever.
    Cheers
    David

  • How we can store start time & end time taken by execution of scenerio?

    Hi
    i want to store starting time and ending time taken by executing of any scenerio and date also on which scenerio will be executed.
    plz assist me regards the same
    thanks

    when you say store , you want to capture in some file ,email or table.
    If table , you can have a small sql linking SNP_SESSION and SNP_SCEN and fetching the required detail accordingly.

  • Got a mac book pro a month back, the bootup time taken now is much more. Requesting possible solutions. Thanks.

    Got a mac book pro a month back, the bootup time taken now is much more as compared to earlier. Requesting some possible solutions.
    Thanks,
    Sid

    Linc,
    As per your instructions, these were the messages that were logged in the first few minutes after start up.
    Jul 17 21:17:18 localhost com.apple.launchd[1]: *** launchd[1] has started up. ***
    Jul 17 21:17:37 localhost com.apple.usbmuxd[22]: usbmuxd-211 built on Feb  8 2011 at 13:49:43 on Feb  8 2011 at 13:49:43, running 64 bit
    Jul 17 21:17:39 localhost bootlog[41]: BOOT_TIME: 1310917638 0
    Jul 17 21:17:39 localhost mDNSResponder[29]: mDNSResponder mDNSResponder-258.21 (May 26 2011 14:40:13) starting
    Jul 17 21:17:39 localhost configd[13]: bootp_session_transmit: bpf_write(en1) failed: Network is down (50)
    Jul 17 21:17:39 localhost configd[13]: DHCP en1: INIT-REBOOT transmit failed
    Jul 17 21:17:39 Siddharth-Jaswas-MacBook-Pro configd[13]: setting hostname to "Siddharth-Jaswas-MacBook-Pro.local"
    Jul 17 21:17:39 Siddharth-Jaswas-MacBook-Pro configd[13]: network configuration changed.
    Jul 17 21:17:42 Siddharth-Jaswas-MacBook-Pro blued[16]: Apple Bluetooth daemon started
    Jul 17 21:17:43 Siddharth-Jaswas-MacBook-Pro /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow[30]: Login Window Application Started
    Jul 17 21:17:43 Siddharth-Jaswas-MacBook-Pro com.apple.kextd[10]: Can't load /System/Library/Extensions/IOSerialFamily.kext/Contents/PlugIns/InternalModemSu pport.kext - no code for running kernel's architecture.
    Jul 17 21:17:43 Siddharth-Jaswas-MacBook-Pro com.apple.kextd[10]: Failed to load /System/Library/Extensions/IOSerialFamily.kext/Contents/PlugIns/InternalModemSu pport.kext - (libkern/kext) requested architecture/executable not found.
    Jul 17 21:17:43 Siddharth-Jaswas-MacBook-Pro com.apple.kextd[10]: Load com.apple.driver.InternalModemSupport failed; removing personalities.
    Jul 17 21:17:44 Siddharth-Jaswas-MacBook-Pro loginwindow[30]: Login Window Started Security Agent
    Jul 17 21:17:45 Siddharth-Jaswas-MacBook-Pro loginwindow[30]: Login Window - Returned from Security Agent
    Jul 17 21:17:45 Siddharth-Jaswas-MacBook-Pro loginwindow[30]: USER_PROCESS: 30 console
    Jul 17 21:17:45 Siddharth-Jaswas-MacBook-Pro com.apple.launchd.peruser.501[86] (com.apple.ReportCrash): Falling back to default Mach exception handler. Could not find: com.apple.ReportCrash.Self
    Jul 17 21:17:45 Siddharth-Jaswas-MacBook-Pro configd[13]: network configuration changed.
    Jul 17 21:17:50 Siddharth-Jaswas-MacBook-Pro com.apple.launchd.peruser.501[86] (com.apple.Kerberos.renew.plist[110]): Exited with exit code: 1
    Jul 17 21:17:50 Siddharth-Jaswas-MacBook-Pro com.apple.usbmuxd[22]: HandleUSBMuxDictionary client 0x101800ab0-iTunesHelper/com.apple.iTunesHelper using library usbmuxd-211 built on Jan 13 2011 at 04:19:31, running usbmuxd-211 built on Feb  8 2011 at 13:49:43
    Jul 17 21:18:10 Siddharth-Jaswas-MacBook-Pro [0x0-0xf00f].com.google.Chrome[140]: [0717/211810:INFO:breakpad_mac.mm(89)] Breakpad disabled
    Jul 17 21:18:16 Siddharth-Jaswas-MacBook-Pro [0x0-0xf00f].com.google.Chrome[140]: [140:519:54119099370:ERROR:CONSOLE(6465)] "Uncaught TypeError: Cannot read property 'can_uninstall' of undefined", source: chrome://newtab/ (6465)
    Thanks,
    Sid

  • Execute some method once an effect has been played

    Hi everybody, I want to execute a method after the effect i have played is finished. is there any property in AnimationProperty tag to acheive it.
    In the component i have pasted below, getting data from xml file and using repeater populate those data in Hbox then it moves the horizontal scroll position of HBox using animation property. once animation property has been played, it has to execute some method. how can we do it ?
    the next question is
    i want to play animation propery infinite times and i have done it with the help of repeatCount but it takes some delay in between. how can it play infinite imes without any delay in between.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="getXML.send(),slide(event)" >
    <mx:Script>
            <![CDATA[
                import mx.containers.Canvas;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;
                import mx.effects.easing.*;
                import mx.controls.*;
                import mx.collections.*;
                [Bindable] public static var refThumb : Thumbnail;
                [Bindable] public var xmlData : XMLListCollection = new XMLListCollection();
                [Bindable] public var xml :XMLList;
                public function resultHandler(event :ResultEvent) : void
                    xml = event.result.product as XMLList;
                public function faultHandler(event :FaultEvent):void
            public function slide(event :Event):void{
               ap.play();
        ]]>
    </mx:Script >
        <mx:AnimateProperty id="ap" effectEnd="{Web.refWeb.nextSlider()}" repeatCount="0" property="horizontalScrollPosition" fromValue="0" target="{can}" toValue="7200" duration="72000" startDelay="0"/>
        <mx:HTTPService id="getXML" showBusyCursor="true" url="catalog.xml" resultFormat="e4x" result="resultHandler(event)" fault="faultHandler(event)" />
        <mx:HBox paddingTop="20" id="can" width="600" height="200" backgroundColor="white" horizontalScrollPolicy="off" verticalScrollPolicy="off" backgroundAlpha="0.2"  >
        <mx:Repeater id="rep" dataProvider="{xml}" >
            <mx:VBox id="comp" horizontalAlign="center" horizontalGap="200" width="200" height="200" verticalScrollPolicy="off" horizontalScrollPolicy="off">
                             <mx:Image source="{rep.currentItem.image}" width="150" height="100" maintainAspectRatio="false" />
                             <mx:Text text="{rep.currentItem.name}" fontWeight="bold" />
                             <mx:Text text="{'$ '+ rep.currentItem.price}" fontWeight="bold" />
                             <mx:LinkButton label="Add cart" color="blue" />
             </mx:VBox>
        </mx:Repeater>
        </mx:HBox>
    </mx:VBox>

    you have posted a VBox component code so it will be the part of your parent Application are you injecting data into this component from the main application ? and your
    httpService requires catalog.xml so you need to attach that file so i can run on my side successfully . instead of doing this you can tell the problem you are having so i can guide you on that
    regards,
           ATIF.

  • How to Measure time taken for a some lines of code in a program?

    Hi
    I have one requirement to measure time taken for executing a  block of code in report . How we can find it ?
    Is there any way to code something in report to caluculate it ?
    Please send solution as early as possible
    thank u

    Ok.. try this code...
    DATA : t1 TYPE i,
    t2 TYPE i,
    delta(16) TYPE p.
    GET RUN TIME FIELD t1.
    PERFORM get_data. "your block of code
    GET RUN TIME FIELD t2.
    delta = t2 - t1.
    delta = delta / 1000000.
    WRITE :/ 'Time elapsed : ', delta , 'Secs'. "time in secs.

Maybe you are looking for