How to find the Execution Time for Java Code?

* Hi everyone , i want to calculate the execution time for my process in java
* The following was the ouput for my coding,
O/P:-
This run took 0 Hours ;1.31 Minutes ;78.36 Seconds
*** In the above output , the output should come exactly what hours , minutes and seconds for my process,
but in my code the minutes are converted into seconds(It should not)...
* Here is my coding,
    static long start_time;
    public static void startTime()
        start_time = System.currentTimeMillis();
    public static void endTime()
        DecimalFormat df = new DecimalFormat("##.##");
        long end_time = System.currentTimeMillis();
        float t = end_time - start_time;
        float sec = t / 1000;
        float min = 0, hr = 0;
        if (sec > 60) {
            min = sec / 60;
        if (min > 60) {
            hr = min / 60;
        System.out.println("This run took " + df.format(hr) + " Hours ;"+ df.format(min) + " Minutes ;" + df.format(sec) + " Seconds");
    }* How to Calcualte exact timing for my process....
* Thanks

* Hi flounder, Is following code will wotk perfectly?
     public static void endTime()
          DecimalFormat df = new DecimalFormat("##.##");
          long end_time = System.currentTimeMillis();
          float t = end_time - start_time;
          float sec = t / 1000;
          float min = 0, hr = 0;
          while(sec >= 60){
     min++;
     sec = sec -60;
     if (min >= 60){
     min = 0; //or min = min -60;
     hr++;
          System.out.println("This run took " + df.format(hr) + " Hours ;"+ df.format(min) + " Minutes ;" + df.format(sec) + " Seconds");
     }

Similar Messages

  • How to find the Latency time in java.

    How to find the Latency time in java.

    long start = System.currentTimeMillis();
    doTheWork();
    long durationInMillis = System.currentTimeMillis() - start;You might repeat doTheWork() several (100-1000 or more) times if it is fast and the granularity of your system clock is not good enough.

  • How to find the  System Dbtype in java code

    How to find the System Dbtype in java code
    I need various Db connection my project (oracle, sq l,sybase,db2),So How to find the System Dbtype in java code

    Welcome to the Forums.
    Please go through the FAQ of the Forum.
    You has posted your query in the wrong Forum, this one is dedicated to Oracle Forms.
    Please try {forum:id=1050}.
    Regards,

  • How to find the execution time of a query?

    hi guys,
    i need to find the execution time of a query.
    i tried finding it in rsrt but couldn find the execution time.
    pleasse let me know the way to do it..
    regards
    sagar

    Hi sagar,
    If you want to know the frontend time, first of all you need to maitain the BW Statistics. To maintain you have to go the respective target and click on it. Go to the tools, select BW Statistics of infoprovider. It pop ups a window there you find two check boxes 1) WHM and 2) Front end time. Check both.
    Now Exe query and close the analyzer. Then go to SE11 table RSDDSTAT. There is one field which displays Frentend time.
    OR
    Go to STO3 here also you can analys the frontend time.
    If you feel useful Assign Pts.
    Regards,
    Vishal

  • How to find the Response time for a particular Transaction

    Hello Experts,
            Am implementing a BAdI to achieve some customer enhancement for XD01 Transaction . I need to confirm to customer that after the implementation and before implementation what is the response time of the system
    Response time BEFORE BAdI Implementation
    Response time AFTER BAdI Implementation
    Where can i get this.
    Help me in this regard
    Best Regards
    SRiNi

    Hello,
    Within STAD, enter the time range that the user was executing the transaction within as well as the user name. The time field indicates the time when the transaction would have ended. STAD adds some extra time on using your time interval. Depending on how long the transaction ran, you can set the length you want it to display. This means that if it is set to 10, STAD will display statistical records from transactions that ended within that 10 minute period.
    The selection screen also gives you a few options for display mode.
    - Show all statistic records, sorted by star
    This shows you all of the transaction steps, but they are not grouped in any way.
    -Show all records, grouped by business transaction
    This shows the transaction steps grouped by transaction ID (shown in the record as Trans. ID). The times are not cumulative. They are the times for each individual step.
    -Show Business Transaction Tots
    This shows the transaction steps grouped by transaction ID. However, instead of just listing them you can drill from the top level down. The top level will show you the overall response time, and as you drill down, you can get to the overall response time.
    Note that you also need to add the user into the selection criteria. Everything else you can leave alone in this case.
    Once you have the records displayed, you can double click them to get a detailed record. This will show you the following:
    - Breakdown of response time (wait for work process, processing time, load time, generating time, roll time, DB time, enqueue time). This makes STAD a great place to start for performance analysis as you will then know whether you will need to look at SQL, processing, or any other component of response time first.
    - Stats on the data selected within the execution
    - Memory utilization of the transaction
    - RFCs executed (including the calling time and remote execution time - very useful with performance analysis of interfaces)
    - Much more.
    As this chain of comments has previously indicated, you are best off using STAD if you want an accurate indication of response time. The ST12 (combines SE30 ABAP trace and ST05 SQL trace) trace times are less accurate that the values you get from ST12. I am not discounting the value of ST12 by any means. This is a very powerful tool to help you tune your transactions.
    I hope this information is helpful!
    Kind regards,
    Geoff Irwin
    Senior Support Consultant
    SAP Active Global Support

  • Performance Tuning -To find the execution time for Select Statement

    Hi,
    There is a program that takes 10 hrs to execute. I need tune its performance. The program is basically reading few tables like KNA1,ANLA,ANLU,ADRC etc and updates to Custom table. I did my analysis and found few performance techniques for ABAP coding.
    Now my problem is, to get this object approved I need to submit the execution statistics to client.I checked both ST05 and SE30. I heard of a Tcode where we can execute a select statement and note its time, then modify and find its improved Performance. Can anybody suggest me on this.
    Thanks,
    Rajani.

    Hi,
    This is documentation regarding performance analysis. Hope this will be useful
    It is a general practice to use           Select  *  from <database>…     This statement populates all the values of the structure in the database.
    The effect is many fold:-
    •     It increases the time to retrieve data from database
    •     There is large amount of unused data in memory
    •     It increases the processing time from work area or internal tables
    It is always a good practice to retrieve only the required fields. Always use the syntax      Select f1  f2  …  fn  from <database>…      
    e.g.     Do not use the following statement:-
         Data: i_mara like mara occurs 0 with header line.
         Data: i_marc like marc occurs 0 with header line.
         Select * from mara
              Into table i_mara
              Where matnr in s_matnr.
         Select * from marc
              Into table i_marc
              For all entries in i_mara
              Where matnr eq i_mara-matnr.
         Instead use the following statement:-
                                       Data: begin of i_mara occurs 0,
                                            Matnr like mara-matnr,
                                                  End of i_mara.
         Data: begin of i_marc occurs 0,
              Matnr like marc-matnr,
                                            Werks like marc-werks,
                                                 End of i_marc.
         Select matnr from mara
              Into table i_mara
              Where matnr in s_matnr.

  • How to find the execution time

    Hi
    I don't know whether it is possible in Oracle or not?
    Say i have got around 20 odd Views in my DB and couple of them based on Materialized View which is again created by joining more than 5 based tables.
    Even most of the Views are also created by joining base tables and MV's.
    When i execute Select count(*) from <viewname>;
    I do get the count of rows and on avg each view returns more that 30lacs row.
    And when i excute select * from <View_name> by setting the Time on.
    It takes more than 2 hours to return the rows.I know the elapsed time of a query do depend of external factors as well such as number of users using the DB Object used in thoe views,Number of process involved and all.
    And therefore in order to gather the elapsed time of each and every view will take more than a week .
    I would appreciate if anyone can provide me a better approach or even a shell script or something like that which will give me the elapsed time of all the views if i query (Select * from <view_name>);
    Thanks in advance.
    Vineet

    But to SomeoneElse's point, if you are running
    SELECT * FROM view_namefrom SQL*Plus, what you are primarily measuring is how fast your network is (because you're spending a great deal of time sending data from the database to the client) and the speed of the SQL*Plus client on your machine (which has to fetch that data, which may have to format and display that data, etc.) It is not a particularly meaningful metric. If you tuned the client machine so that SQL*Plus wasn't displaying the data, if you increased the fetch size, etc. you could drastically decrease the time it would take to send all the data to your client machine, but that is probably not going to constitute tuning for anyone other than you (i.e. you might see a halving of run time while everyone else saw no change).
    Beyond that, doing a SELECT * with no criteria is likely to involve execution plans that no one else will see, data access patterns no one else will see, etc. which just makes the benchmark you are proposing irrelevent.
    If you really, really want to measure how quickly your client can pull the data from all the views, you could of course let that run for a week. But the number wouldn't mean anything.
    Justin

  • How to find overall execution time for a report

    Hi,
    I want to know the total time duration which is taken by my Report. (To fetch(read) the data from database and to print them after filtering.
    Can you please tell me a way to do so.
    Thakns
    Deepak Sisodia

    Hi Deepak,
    Open the report and refresh the report after successful retrival of data go in Report--Performance Information.
    You will get all information related to report and execution time.
    Thanks,
    Sastry

  • How to increase the waiting time for response in Adapter Engine not in IE

    Hi Experts,
                It is a SOAP to Proxy Synchronous interface. SOAP system is sending the request to PI, PI sending the same request to ECC system, After execution of some logic response back to PI in 7 minutes. In ABAP Stack(sxmb_moni) processing the response message also successfully with success flag after completion of these 7 minutes. But exactly 5 minutes later getting the error at Java Stack RWB- in communication channel monitoring i.e
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.MessageExpiredException: Message bd2bf8d0-b2c2-11e0-c383-001cc4fb5cb7(OUTBOUND) expired.  We have set the "runtime-HTTP_TIMEOUT" parameter as 3600. thats why in Integration engine it is processing successfully.
    kindly suggest me how to increase the waiting time for response in Adapter Engine. Exactly after 5 mins getting the above error in rwb, but in Integration Engine getting successful flag after 7 mins until then it is waiting for response with  status flag Log version.
    Thanks & Regards,
    Srihari.

    Hi,
    Please see
    How To... Investigate Timeouts In Synchronous XI/PI Scenarios
    It will answer all your queries
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c059d583-a551-2c10-e095-eb5d95e03747?QuickLink=index&overridelayout=true

  • How to find the customer exits for a particular transaction

    hi
    how to find the customer exits for a particular transaction

    Hi jyothsna vankadari ,
    ther is a convenient way to find all BADIS called. You may know that BADIS are the newer version of EXITs.
    I would suggest you to go for BADI.
    Follow the below steps to find out what all BADI's are called when you press any button in any transaction.
    1) Goto se24 (Display class cl_exithandler)
    2) Double click on the method GET_INSTANCE.
    3) Put a break point at Line no.25 (CASE sy-subrc).
    Now
    4) Execute SAP standard transaction
    5) Press the required button for which you need to write an exit logic, the execution will stop at the break point.
    6) Check the values of variable 'exit_name', it will give you the BADI name called at that time.
    7) This way you will find all the BADIs called on click of any button in any transaction.
    Regards,
    Clemens

  • How to create the exe files for java application

    How to create the exe file for java application?
    got any software to do that?
    Thanks

    In terms of converting java applications into exe files, there are 3 schools of thought:
    1) Instead of converting it to an exe, convert it to a jar file. Jar files are more portable than exe files because they can be double-clicked on any operating system. The caveat is that a Java interpreter must be installed on the target computer for the double-clicking to work.
    http://developer.java.sun.com/developer/Books/javaprogramming/JAR/
    2) Create an exe launcher that, when double-clicked, attempts to find a Java interpreter on the local computer and launches the Java application. The exe file is still double-clickable but whether your java application runs depends on whether a Java interpretor is installed on the target computer.
    http://www.sureshotsoftware.com/exej/
    http://www.objects.com.au/products/jstart/index.jsp
    http://www.duckware.com/products/javatools.html
    http://www.ucware.com/jexec/
    http://www.rolemaker.dk/nonRoleMaker/javalauncher/
    http://www.jelude.cjb.net/
    http://thor.prohosting.com/~dfolly/java/index.html
    3) Create an exe launcher that bundles a Java interpretor. Same as above but when the exe file is double-clicked, it searches for a Java interpreter and if one is not found, it installs one on the target computer. The caveat is that the exe file would have an overhead of 10 MB in size for the interpreter.
    http://www.excelsior-usa.com/jet.html (evaluation version available)
    4) Convert the Java application into a native exe file. The caveat is that if you use Swing for your GUI, it won't be converted. Also this option is still somewhat experimental.
    Can't think of any free options right now.

  • How to  find the user exit for a screen..

    Hi,
    plz help me how to find the user exit for a screen..?
    Regards
    Anbu

    Hi,
    check this program this will give you the list of user-exit and BADI for the perticular Tcode.
    REPORT  zuserexit_badi.
    TABLES : tstc,
    tadir,
    modsapt,
    modact,
    trdir,
    tfdir,
    enlfdir,
    sxs_attrt ,
    tstct.
    DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
    DATA : field1(30).
    DATA : v_devclass LIKE tadir-devclass.
    PARAMETERS : p_tcode LIKE tstc-tcode,
    p_pgmna LIKE tstc-pgmna .
    DATA wa_tadir TYPE tadir.
    START-OF-SELECTION.
      IF NOT p_tcode IS INITIAL.
        SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode.
      ELSEIF NOT p_pgmna IS INITIAL.
        tstc-pgmna = p_pgmna.
      ENDIF.
      IF sy-subrc EQ 0.
        SELECT SINGLE * FROM tadir
        WHERE pgmid = 'R3TR'
        AND object = 'PROG'
        AND obj_name = tstc-pgmna.
        MOVE : tadir-devclass TO v_devclass.
        IF sy-subrc NE 0.
          SELECT SINGLE * FROM trdir
          WHERE name = tstc-pgmna.
          IF trdir-subc EQ 'F'.
            SELECT SINGLE * FROM tfdir
            WHERE pname = tstc-pgmna.
            SELECT SINGLE * FROM enlfdir
            WHERE funcname = tfdir-funcname.
            SELECT SINGLE * FROM tadir
            WHERE pgmid = 'R3TR'
            AND object = 'FUGR'
            AND obj_name EQ enlfdir-area.
            MOVE : tadir-devclass TO v_devclass.
          ENDIF.
        ENDIF.
        SELECT * FROM tadir INTO TABLE jtab
        WHERE pgmid = 'R3TR'
        AND object IN ('SMOD', 'SXSD')
        AND devclass = v_devclass.
        SELECT SINGLE * FROM tstct
        WHERE sprsl EQ sy-langu
        AND tcode EQ p_tcode.
        FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
        WRITE:/(19) 'Transaction Code - ',
        20(20) p_tcode,
        45(50) tstct-ttext.
        SKIP.
        IF NOT jtab[] IS INITIAL.
          WRITE:/(105) sy-uline.
          FORMAT COLOR COL_HEADING INTENSIFIED ON.
    Sorting the internal Table
          SORT jtab BY object.
          DATA : wf_txt(60) TYPE c,
          wf_smod TYPE i ,
          wf_badi TYPE i ,
          wf_object2(30) TYPE c.
          CLEAR : wf_smod, wf_badi , wf_object2.
    Get the total SMOD.
          LOOP AT jtab INTO wa_tadir.
            AT FIRST.
              FORMAT COLOR COL_HEADING INTENSIFIED ON.
              WRITE:/1 sy-vline,
              2 'Enhancement/ Business Add-in',
              41 sy-vline ,
              42 'Description',
              105 sy-vline.
              WRITE:/(105) sy-uline.
            ENDAT.
            CLEAR wf_txt.
            AT NEW object.
              IF wa_tadir-object = 'SMOD'.
                wf_object2 = 'Enhancement' .
              ELSEIF wa_tadir-object = 'SXSD'.
                wf_object2 = ' Business Add-in'.
              ENDIF.
              FORMAT COLOR COL_GROUP INTENSIFIED ON.
              WRITE:/1 sy-vline,
              2 wf_object2,
              105 sy-vline.
            ENDAT.
            CASE wa_tadir-object.
              WHEN 'SMOD'.
                wf_smod = wf_smod + 1.
                SELECT SINGLE modtext INTO wf_txt
                FROM modsapt
                WHERE sprsl = sy-langu
                AND name = wa_tadir-obj_name.
                FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
              WHEN 'SXSD'.
    For BADis
                wf_badi = wf_badi + 1 .
                SELECT SINGLE text INTO wf_txt
                FROM sxs_attrt
                WHERE sprsl = sy-langu
                AND exit_name = wa_tadir-obj_name.
                FORMAT COLOR COL_NORMAL INTENSIFIED ON.
            ENDCASE.
            WRITE:/1 sy-vline,
            2 wa_tadir-obj_name HOTSPOT ON,
            41 sy-vline ,
            42 wf_txt,
            105 sy-vline.
            AT END OF object.
              WRITE : /(105) sy-uline.
            ENDAT.
          ENDLOOP.
          WRITE:/(105) sy-uline.
          SKIP.
          FORMAT COLOR COL_TOTAL INTENSIFIED ON.
          WRITE:/ 'No.of Exits:' , wf_smod.
          WRITE:/ 'No.of BADis:' , wf_badi.
        ELSE.
          FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
          WRITE:/(105) 'No userexits or BADis exist'.
        ENDIF.
      ELSE.
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
        WRITE:/(105) 'Transaction does not exist'.
      ENDIF.
    AT LINE-SELECTION.
      DATA : wf_object TYPE tadir-object.
      CLEAR wf_object.
      GET CURSOR FIELD field1.
      CHECK field1(8) EQ 'WA_TADIR'.
      READ TABLE jtab WITH KEY obj_name = sy-lisel+1(20).
      MOVE jtab-object TO wf_object.
      CASE wf_object.
        WHEN 'SMOD'.
          SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
          CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
        WHEN 'SXSD'.
          SET PARAMETER ID 'EXN' FIELD sy-lisel+1(20).
          CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
      ENDCASE.
    Reagards,
    Bharat.

  • How to find the text id for the text in the sales order

    Hi all,
    How to find the text id for the item-text in the sales order?
    There are different Text available in  the sales order under item like Warehouse instruction, CSR instruction...
    I want to know the corresponding Text id for the text ELECTRONIC ORDER COMMENT.
    Table TTXID contains the validation of the Text id.
    Please help me in knowing the way to identify the text-id from the text list..
    Thanks foryour help
    Suresh Kumar

    U can fetch the texts for the items using
    Read_text.
    Example:
        g_f_tdname = xvttp-vbeln.
        g_f_obj = p_obj.
        g_f_langu = 'DE'.
        REFRESH g_t_lines.
        CLEAR g_t_lines.
        CALL FUNCTION 'READ_TEXT'
             EXPORTING
                  id                      = p_var
                  language                = g_f_langu
                  name                    = g_f_tdname
                  object                  = g_f_obj
             TABLES
                  lines                   = g_t_lines
             EXCEPTIONS
                  id                      = 1
                  language                = 2
                  name                    = 3
                  not_found               = 4
                  object                  = 5
                  reference_check         = 6
                  wrong_access_to_archive = 7
                  OTHERS                  = 8.
        IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    The Required fields are,
    Text-id ,language,name,object.
    Let me know if you further require help.
    Regards

  • How to create the exe file for java project.

    How to create the exe file for java project.
    am done the project in java swing , i like to create the project in exe format, so any one help for me,
    send the procedure for that.
    thanking u.

    How to create the exe file for java project.Have you ever heard of google? I pasted your exact "question" into a google search:
    http://www.google.com/search?q=How+to+create+the+exe+file+for+java+project.
    and got several useful links.
    Better search terms might yield even better results.
    Sheesh.

  • How to find the workflow admins for all costcenters ?

    Dear SRM gurus
    We are using Classic scenario with N th step workflow with BADI.
    we have a requirement.
    How to find the workflow admins for the particular costcenters.
    we used HRV1222A where ATTRIB EQ <Z attribute>(This is our own attribute to group all the costcenters)
    used table HRP1001 to find the Admins but results are not correct because it is not showing my user id(I have all authorisations).
    Is there anyway to find all the admins for a cost center(users are more than 7000+)
    can anybody send work flow related presentations or cookbook
    Thanks in Advance.
    srinu

    hi
    I have not received any thing.Please send again
    [email protected]
    [email protected]

Maybe you are looking for