Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we count the time of process?

Tags:

timer

popup

gwt

I created a PopupPanel and have shown it. I want to hide it after one minute has passed. During that one minute, the process should not be stopped or paused. How can I achieve this behavior?

like image 531
varakumar.pjd Avatar asked Oct 28 '10 09:10

varakumar.pjd


People also ask

How is process time calculated?

On any given processor, the total waiting time for an ordered set of processes taking time P1.. PN to complete is the total of individual elapsed times multiplied by the number of waiting processes remaining: (N - 1)P1 + (N - 2)P2 + ... + PN-1.

How do you calculate execution time?

Calculate the execution time The difference between the end time and start time is the execution time. Get the execution time by subtracting the start time from the end time.

What is total process time?

Overview: What is process time? The time it takes from when an item enters a process until it exits a process is called process lead time (PLT), or Little's Law. That total time consists of the processing time at each workstation plus any waiting or queue time while in the process.

What is process time and cycle time?

The process time is the time a workpiece takes to enter and exit a workstation. Cycle time normally refers to the time it takes to work on a unit from start to finish.


2 Answers

Try to use: java.util.Timer

And you can do something like this:

int seconds = 60;
Timer timer = new Timer();
timer.schedule(new YourScheduledTask(), seconds * 1000);

Exmaple: Use java.util.Timer to schedule a task to execute once 5 seconds have passed

like image 43
zengr Avatar answered Sep 20 '22 03:09

zengr


GWT has its own implementation of Timer.

Here a really small example:

public void onModuleLoad() {
    final PopupPanel popUp = new PopupPanel();
    Label text = new Label("gone in a sec");
    popUp.setWidget(text);

    Timer timer = new Timer() {

        @Override
        public void run() {
            popUp.hide();
        }

    };

    popUp.center();
    timer.schedule(3000);
}
like image 54
z00bs Avatar answered Sep 21 '22 03:09

z00bs