Starting a time counter

Hi,
I'd want to start a time counter when an event occur ( data_available = true ) and then I want to stop it when I finish to elaborate the data, so that Ican know how many time I spend to elaborate those data.
How can I do?

Try:
     private long methodDoingTheTask(){
          long startTime = System.currentTimeMillis();
          //perform the task
          return (System.currentTimeMillis()-startTime);
     }You will get number of milisecond it took to do a task as a return value :)

Similar Messages

  • Calculate report execution start & end time (Not use SE30)

    Dear all Abaper,
    I am writing a report which recorded the execution start & end time
    The following is a part of my coding.
    Data : GV_ST_TIME LIKE SY-UZEIT.  "START TIME
    Data : GV_EN_TIME LIKE SY-UZEIT.  "END TIME
    START-OF-SELECTION.
    GV_ST_TIME = SY-UZEIT.
    END-OF-SELECTION.
    GV_EN_TIME = SY-UZEIT.
    WRITE: / 'START TIME:', GV_ST_TIME.
    WRITE: / 'END TIME:', GV_EN_TIME.
    Suppose the report has executed 5 second
    from time : 00:00:00 to 00:00:05.
    But in the output screen, the start time and end time always display the same time(00:00:05) if following the above coding.
    However, if in the debugging mode, the start time and
    end time will be different and really counted.
    Does anyone know the reason and how to fix it if I don't wanna use SE30?
    Thx in advance~

    Hi boris,
    1. minor problem
    2. we have to REFRESH the time value
    3. using GET TIME.
       (Then it will work correctly)
    4.
    START-OF-SELECTION.
    <b>GET TIME.</b>
    GV_ST_TIME = SY-UZEIT.
    END-OF-SELECTION.
    <b>GET TIME.</b>
    GV_EN_TIME = SY-UZEIT.
    regards,
    amit m.

  • How to synchronize two timer/counter tasks?

    Hi,
    I'm programming DAQmx through the nicaiu.dll with Matlab. I'm trying to start two different tasks, each controlling ctr0 and ctr1, respectively. Both timer/counter tasks should start on a common trigger, in my case /Dev/PFI0. Having searched the forum, I do understand that both tasks can't be triggered off PFI0. Instead, I probably need to trigger one of my tasks on a signal that turns on whenever the first task starts. My question is; What signal can inform my ctr1 task that my ctr0 has started? I basically want these two tasks synchronized, but not pulse by pulse since the pulse trains are quite different.
    Trying to trigger both off PFI0 results in a resource conflict. Triggering ctr1 on ctr0gate doesnt work either.
    Also, I need ctr1 to trigger on when the ctr0 tasks starts, i.e. not when the first ctr0 pulse appaers!
    Thanks,
    Per

    Thanks Ryan.
    I made some changes to my code now and it appears I CAN trigger both counters off PFIO (on an E-Series board). I only recently converted all my Traditional code into DAQmx, and got lost in my tracks. I was trying to generate finite pulse trains on both counters, and had used Finite timing on the counters to generate finite retriggerable pulse trains, without knowing that tied up the second counter. I solved this now using Pause Triggers instead. In the case where I generate single retriggerable pulses I still use a Start Trigger, and I can now Start BOTH counters using DAQmxCfgDigEdgeStartTrig and listening to PFIO with both counters (each counter running off a separate task).
    Sorry, I got things confused, and your solution isnt required anymore. Similarly to your solution, though, I have always used a (real) analog output routed externally to the PFI0 pin on my E-Series board as the synchronizing trigger. However, if I could avoid the external wiring it would be nice, so I will explore your solution a bit more
    I am not familiar with the concept of a 'dummy' task/channel. Can you point me to more documentation on this?
    I already use the analog inputs on this board from another app. Will creating a dummy AI tie up all analog inputs, so I can't then access my physical analog inputs from other applications (on the same board)?
     - Per

  • How to create a time counter

    Hello expertsl,
    I have a new challenge on board.
    I have a form that is automatically popped up. Now on the form, i need to insert a timer that as soon as it pops out, the timer starts and then i have to enter some data in the form and as soon as i press the save button, the timer records the time count and then stores it in a table.
    Any suggestion are the most welcome...
    Thank you

    As Hoek said, this is not a Forms forum.
    However, the problem is not really unique to Forms and a timer itself is not needed.
    A timer is a kernel object that fires at specific intervals and each time around executes a callback routine. This allows one to update or process at specific intervals.
    You do not need a timer as you are interested in time elapsed - which means that on the creation of the form you need to get the current time. When the save button is clicked you again get the current time. The data that you are interested in is the time difference between these two.
    Remember that timers are expensive objects to create ito kernel resources. Some operating systems limit the total number of timers that can be created. In general, it is not a good idea to create a timer unless it is the best technical solution for the problem. And you do not need a timer determine a time elapse. You simply need code in the constructor of the form and code in the save events of the form. Nothing more.

  • 880GMA-E45 - Need to press start several times

    Hi,
    880GMA-E45 with a Phenom II X2 555.
    I've unlock the Phenom using auto features of this motherboard (4cores). I've installed Win7 x64 without any problem.
    Then, I've updated the bios to the latest v17.7.
    Now, when I press start, the computer shuts down within few seconds. I do that 3 to 4 times then it starts normally and works correctly. If I set only two core (I keep the unlock feature on). Same problem
    If I disable the unlock feature, it starts on the first try.
    Probably related to the bios update but not 100% sure (with the original bios I've not made a lot of start up ... not sure that it was starting up correctly with unlock core on)
    Any idea?
    Thanks

    Quote from: Bas on 17-November-10, 17:35:09
    That is Intel memory.
    3 sticks on AMD is not a good idea.
    Either use 2 or 4, but not 3.
    Also because it is Intel memory, it can have wrong timings for AMD.
    And please stop the OC stuff until the problem is solved, as OC on top is seeking problems.
    (thanks for your response)
    Already tried with two (and one) memory stick.
    The Phenom is not overclocked and runs at its normal frequency. There's no OC set up in the bios (OC Genie Lite disabled, no manual settings)
    To be short: since the new bios when I use the unlock feature (nothing else changed), I have to press start several times (OC Retry Count +1)
    I don't think the problem is coming from a faulty core  (even if I manually enable one, two or three cores with unlock ON .. same problem)

  • Time counter...

    Hi all....
    How can I using labVIEW to create a stop watch for count the time? anyone have idea about this?
    with regard
    Jaxx
    using labVIEW 7.1 on winXPMessage Edited by @ on 04-12-2005 11:10 PM

    Hi Jaxx
    Attached is a very simple stop watch.
    If you push "Start/Stop" button time counting is started and it runs as long as this button is true.
    Hope it helps.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...
    Attachments:
    Stopwatch.vi ‏22 KB

  • How many kinds of NI card can be a timer/counter

    HI,
      I want to konw which card can be a timer/counter,i only know  M series
    帖子被leexiang在09-21-2005 08:16 AM时编辑过了
    TTech| ATS | NVH | SCADA |

    Jingyan,
    this is from our R Series FAQ:
    Not all applications require the 3M
    gate FPGA. Unfortunately, it is difficult to determine whether an
    application or program will require a 1M or 3M gate FPGA. The following
    can be used as a general guideline when deciding whether to use a 1M or
    3M gate FPGA for your application.
    For an application that will be
    performing the timing, triggering and synchronization on the FPGA, a 1M
    gate FPGA will accommodate the requirements. If the application
    includes timing, triggering and synchronization along with additional
    signal processing on the FPGA (control, digital filtering, complex
    analog triggering), the 3M gate FPGA will give more FPGA fabric to
    implement these operations
    This statement accords also to my own experience so with the facts that you have provided I would go for the 3M FPGA.
    The NI SoftMotion Development Module is a great help for designing motion control applications with LV FPGA. There are a lot of shipping examples that can be modified to your needs. I was up and running with my first FPGA based motion control solution and the SoftMotion Development Module in less than 5 hours including all cabling and compiling. Even if you don't use many of your features in your final application this module gives you a jump-start for FPGA based motion control solutions. So yes, I recommend to use the module, but no, it's not absolutely necessary. Of course you can program everything by your own.
    Regarding the AI/AO noise and accuracy specifications please refer to the 7831R user manual. In general the noise level is much better than the 10 mV that you have mentioned.
    Best regards,
    Jochen Klier
    National Instruments Germany
    Message Edited by Jochen on 08-07-2006 11:03 AM

  • Time count down problem

    Hi,
    Please I need help with time count down display.
    I am using a state machine. In one of the cases ‘rest’ time is calculated. In the next case the vi waits for the ‘rest’ period to expire before continuing with the next case (the stop button should remain active the entire time). The ‘rest’ time count down should be displayed.
    I tried to use Elapsed Time.vi but it works properly only the first time around. Can somebody please help me? I am attaching a sample VI.
    Also how can I accomplish displaying the Program Run Time with no interruptions?
    Thank you in advance for your advice and help.
    Attached: Display Elapsed Time.vi
    Solved!
    Go to Solution.
    Attachments:
    Display Elapsed time.vi ‏34 KB

    It is because you have the Elapsed Time Timer set to Auto-Reset.  As soon as the time has elapsed, it will start counting again.
    Turn off Auto-reset.  Put a True value into a shift register in the state that leads into the DoSomething2, wire that shift register to the Reset input.  Let the default be False for all other cases of the state machine.
    Now when you get ready to go to that state, the True value placed into the shift register will reset the timer.

  • How to create a time counter without using Sleep()?

    I want to create a time counter that would count from 120 minutes and down. I thought about using Sleep() but I have found out that Sleep() is not accurate (so maybe the countdown would take 122 minutes instead of 120 minutes!). What other alternatives do
    I have?
    Note that I want to count 1 second at a time, because I want to show the countdown progress to the user in seconds.

    The next experiment still uses Sleep and waits for approximately 12 seconds, displaying the time each second. However it is probably too overcomplicated compared to time polling:
    const
    int SECONDS_TO_WAIT =
    12;
    ULARGE_INTEGER ul_end;
    FILETIME ft;
    GetSystemTimeAsFileTime( &ft );
    ul_end.LowPart = ft.dwLowDateTime;
    ul_end.HighPart = ft.dwHighDateTime;
    ul_end.QuadPart += 10LL *
    1000 *
    1000 * SECONDS_TO_WAIT;
    for( ;; )
    FILETIME ft;
    GetSystemTimeAsFileTime( &ft );
    ULARGE_INTEGER ul;
    ul.LowPart = ft.dwLowDateTime;
    ul.HighPart = ft.dwHighDateTime;
    if( ul.QuadPart >= ul_end.QuadPart )
    break;
    SYSTEMTIME st;
    FileTimeToSystemTime( &ft, &st );
    Sleep( 1000 - st.wMilliseconds );
    GetSystemTime( &st );
    if( st.wMilliseconds >
    500 )
    FILETIME ft;
    SystemTimeToFileTime( &st, &ft );
    ULARGE_INTEGER ul;
    ul.LowPart = ft.dwLowDateTime;
    ul.HighPart = ft.dwHighDateTime;
    ul.QuadPart += 10LL *
    1000 *
    1000;
    ft.dwLowDateTime = ul.LowPart;
    ft.dwHighDateTime = ul.HighPart;
    FileTimeToSystemTime( &ft, &st );
    // show the time
    SystemTimeToTzSpecificLocalTime( NULL, &st, &st );
    printf( "%02i:%02i:%02i\n", st.wHour, st.wMinute, st.wSecond

  • Macbook pro (2012) was swapped for a new one and my empty hard rive was swapped, but now my start up time has doubled?

    I bought a Macbook 2 weeks ago, in the first week one of the keys broke off so I went to the Apple store and they replaced the whole thing for me. I was asked if I wanted to swap the hard drive for my old one and I said yes just to save myself time, even though my hardrive is completely empty- I havent downloaded any programs, saved any pictures etc.
    Now my start up time on this new Macbook has pretty much doubled - its a blank lit-up screen for a long time before the apple and log in bar appears - has any one else had this problem? This didn't happen on my old one!

    first - go to system preferences - startup disk and select your hard drive as the startup drive....restart your macbook....
    if that doesn't do it, open disk utility and verify your disk permissions - repair them if errors are found....once the repair is done, restart your macbook...
    see if the above sorts outs your issues....
    good luck

  • How do I change the start/stop time for multiple songs not just one song at a time?

    How do I chnage the start/stop time for multiple songs not just one song at a time?

    I don't think you can in iTunes.
    Multiple editing in Get Info does not offer an option to change start/stop times.

  • So i just got an 3T external hard drive and i have moved my itunes over to it successfully and have started using Time Capsule but is there a way to make things i download go directly to my external hard drive and not to my internal one?

    i just got a 3T external hard drive and i have moved my iTunes over to it and i have started using time capsule but when i download things can i make the downloads go directly to my external hard drive? Or make my mac ask me where it should download it to?

    just change the preferecnes for whatever app you're using to download the files to the external drive

  • How to Get Duration, Start/Stop Time of Each Instance (Run)

    Can someone tell me how to get the Duration, as well as Execution Start/Stop times for a given run (Instance) of a Report, stored in History?
    For example, on the BO Server in InfoView, I can browse the History of each report, and for each run, I can click the details and view the Duration and Start/Stop times for that run. How do I get that information in Java via the SDK?
    Neither IProcessInfo nor ISchedulingInfo seems to have this information.
    For example, ISchedulingInfo's Start/Stop Times are for general scheduling (when the report will stop being scheduled). That is not what I want.
    I need specific data for a given completed Run, namely its duration and time endpoints. Thanks a lot.

    Hi,
    fetch the instance of the run like this
    IInfoObjects list = infoStore.query(
    "select SI_STARTTIME , SI_ENDTIME From CI_INFOOBJECTS Where SI_ID=<instanceIDtoMeasure>"
    IInfoObject element = list.get(0);
    Date startTime = element.properties().getDate("SI_STARTTIME");
    System.out.println("Beginn "+ startTime);
    Date endTime = element.properties().getDate("SI_ENDTIME" );
    System.out.println("End " + endTime);
    long time = ((endTime.getTime() - startTime.getTime()) / 1000);
    System.out..println("Runtime " + time + " sec");
    You can get the nstanceIDtoMeasure form your Report with getInstances
    Enjoy
    johannes

  • How to add an "age / time counter" into DW?

    Can anyone assist on how to add an age / time counter into DW?
    In other words to say "Child X is now a years, b months old"? or "Product Z was launched A years B months ago"? Or, on the other hand, "You only have Z days & Y minutes left to enter"? With it updating in real time?
    Apologies in advance if this is a silly / obvious question but I just can't seem to do it!

    This isn't something you would add to DW, you would need to add it to your webpages. You would do this with javascript. Search the web for
    'javascript countdown timer' for plenty of examples.

  • I need to play back a video-recording i have taken myself and have it show the time count in seconds on the play back. Can you help?

    I need to play back a video-recording that I have taken myself and have it show the time counter in secs/minutes in the playback. Can anyone help?

    the movie editing app "Avid Studio" displays a time counter, as does the Pinnacle editing app.  Oddly enough, I movie does not.  (unless I have it somehow turned off.)

Maybe you are looking for

  • Error 4261 - failed disc burn

    DIAGNOSTICS Microsoft Windows XP Home Edition Service Pack 2 (Build 2600) Sony Corporation VGN-S360 iTunes 7.2.0.35 CD Driver 2.0.6.1 CD Driver DLL 2.0.6.2 LowerFilters: PxHelp20 (2.0.0.0), UpperFilters: GEARAspiWDM (2.0.6.1), Current user is an admi

  • Why can I no longer copy and paste a whole page in page thumbnail?

    Why can I no longer copy and paste a whole page in page thumbnail?

  • Another problem with PDF printing

    Hi all. I try new pdf printing in Apex 3.0 with printing engine Apache FOP and BI Publisher. Both engines seems work well. I configured Apex engine to use Standard Support for pdf. Next I imported example application http://www.oracle.com/technology/

  • VS Exp 2013: Unable to create the Web site ... The components for communicating with FTP servers are not installed.

    I have MS Visual Studio Express 2013 It has worked fine for many months and then suddenly (I have made no configuration changes or added new programs) when I try to publish I am getting the message: Unable to create the Web site 'ftp://ftp.xx.xx/xxx.

  • Aperture 3.3.1 update

    I have installed aperture 3.3.1 update but aperture still freezes not responding and I have to force quit...anyone know what else i can do now?? i'm running mac os 10.7.4 this issue has just happened last week after a bunch of software updates