Accurately Calculating the time a Thread takes to run

How do I accurately gain timings for a thread? I have a number of threads which are calling CalculatorEngine which locks on an object starts a timer (ctime = System.currentTimeMillis();) and then logs the time just before the thread exits
System.out.println("Calculations for " + setName + " for " + calcsMadeByCalcEnginge + " positions took: " + (System.currentTimeMillis() - ctime));
But if there is a context swich my timer will continue to run until the thread is reactivated and then completes... How can I gain the actual timings for how long the thread took?

How do I accurately gain timings for a thread? You can't.
>
But if there is a context swich my timer will
continue to run until the thread is reactivated and
then completes... Correct.
How can I gain the actual timings
for how long the thread took?You can't. As I said and as you already pointed out why.
Not to mention that on modern OSes threads in other apps might steal time as well.
You can just run it in a loop, make sure no other resource hungry apps are running and then estimate the time taken.

Similar Messages

  • How much does the time of change take?

    i ve had so many pobems with the reception of my iphone, so last day i called apple, to ask some information about the problem, and the consulent said to me that the iphone would have been taken, to get essistence. so... i'd like to know the time that it takes, the get this... and in what cases the iphone can be change

    call Apple back and ask

  • Problem in VAT Calculation @ the time of MIRO

    Dear All,
    We are using the Tax Procedure TAXINN.
    When we create a LIV document with ref to a PO using the transaction MIRO & when I check the calculate tax button, the tax amount which is displayed in the Basic data is more than the amount which is displayed in the taxes tab.
    For Ex:
    Created a PO with the following details.
    Total Qty in PO -  10
    Base Price - 1000/qty.
    BED - 14% - 1400.00
    ECS - 2% -      28.00
    VAT - 4% - (4% on 11428) - 457.12
    So my total Tax = 1885.12 (Including Excise & VAT).
    Now when I create a MIRO document the tax amount which gets calculated when I check the Calculate button is 1885.12 (Same as above) in the Taxes tab of MIRO.
    But the tax amount which is displayed in the Basic data tab is 1,942.24
    Also when I simulated the MIRO entrys the VAT amount which was simulated was - 514.24  & not 457.12 as in PO.
    Can anyone please advice on the reason for this mismatch in VAT calculation during the time of MIRO?
    Is there any specific settings for VAT in TAXINN ??
    Note :
    The Excise & VAT are calculated correctly during the time of PO creation. Also I havent maintained any additional VAT condition types for my VAT in the tax procedure.
    Awaiting helpful replies.
    Regards,
    Edited by: SAP FC on Dec 5, 2008 3:44 PM

    Hi All,
    Please note that when I removed the VAT condition type JVRD from the Classify condition types settings in IMG  then the VAT amount which is calculated in the Basic data tab of MIRO is equal to the actual Tax amount as in PO (Excise + VAT ), but the amount which is displayed in the tax tab of MIRO is less.
    Now if I maintain the Classify condition types settings in IMG for my VAT condtn type JVRD then the VAT amount which is calculated in basic data is more than both the PO as well as tax tab in MIRO.
    Please note  as you all have suggested I tried this after creating a new material & with the newly maintained condition records in FV11.
    But still the issue persists..
    If anyone have any idea. plz revert.
    Regards,
    Edited by: SAP FC on Dec 9, 2008 10:23 AM

  • Thread CPU time: does it include the time while thread is waiting

    Hi,
    My question is regarding the getCurrentThreadCpuTime() supported by the ThreadMXBean.
    I wonder if the returned time includes the time while the thread is waiting, i.e. after the thread calls wait() and before getting a notify() or a notifyAll().
    Thanks,
    Nuha

    CPU time is intended to reflect actual time executing on a CPU. If block for a lock/wait/sleep or other blocking operation like I/O then you don't consume CPU while blocked.
    On Solaris it is implemented using gethrvtime()
    If a VM used a busy-wait for something rather than blocking (not likely with wait()) then that's consuming CPU time.

  • How come that the time machine backup takes 5 days to sync 200 GB over the ethernet?

    I'm really not happy with the backup speed of the time machine. it has been 1 day and half that it is syncing and for now just 36GB are done of 210GB.
    The remaining time estimation is ridiculous around 5 more days?
    How come this is possible?? I cannot move my mac pro anywhere else it needs to be plug-in 24/7 to the Ethernet and power, of course hoping that everything goes already during these 5 days to backup.
    I've tried different things, I've check my disk for issues also for permission issues none existed.
    I've tried to restart the backup from scratch, even some times it start fast it slows down to a very low transfer rate, and now the current rate of transfer is around 1KB or lower :S
    The soul purpose of the time capsule is to do backups but at this speed rate it's useless, and from what I saw it happens to other people.
    I must have being doing something very wrong, can anyone help me or give me suggestions?
    Regards
    P.S. Mac pro 13'' early 2011 with 8 GB, Mac OX 10.7.5

    The latest update to Lion.. 10.7.5 added slowness of TM as a new feature.. (There are no bugs just features).
    Until Apple sort out their beta testing I would recommend a different backup software. CCC, SuperDuper, Chronosync.
    The issue from reading the various posts is affecting everyone.. including people using external drives.
    Welcome to the new Apple beta program.

  • Fan running all the time on 2010 mba, fan running all the time on 2010 mba

    since i have installed osx lion on my 2010 macbook air the fan is running all the time. any ideas why or should i reinstall snow leopard? my mba is 13inch 1.87 with 2gb and 128gb hdd.

    If the CPU is running at 100%, that will cause the fans to rev. Try logging into another User account and see what happens there.   
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101

  • How we can find the eaxct time which pragram takes to run

    hi,
    i have written a program in two different ways.
    i wnat to check which one is taking less time.
    is there any way we can find out excatly how much time is taken by the rprogram to run when irun it using F8

    The runtime analysis provides an overview of the duration and performance of your source code, from individual statements up to complete transactions.
    Choose Menu  ® Test  ® Runtime Analysis or transaction SE30 to start the runtime analysis. In the initial screen, you see the four main functions of this tool, which can be activated by pushing the corresponding button.
    ·         Measurement in dialog status
    ·         Measurement of external session
    ·        Selection of measurement restrictions
    ·         Evaluation of measurement results
    With large applications, it is advisable to first analyze the entire application and then check details in the hit lists.
    With the following information you can carry out the analysis, display and interpret the results, and use this as a basis for optimizing your programs.

  • Why is time-critical thread not interrupting sleepless high priority thread?

    Hello,
    I have two threads running in the same execution system on a real-time PXI platform. The time-critical thread sleeps using "AI Single Scan.VI", and acquires my data at a rate of 8000 Hz.
    I have a slower high priority process that calls a DLL function to calculate some filter coefficients. This function call takes longer than 1/8000 s to complete, and runs in a loop, executing as often as it can (with new data from FIFOs).
    I expected the time-critical thread to interrupt the the high priority thread without problem.
    I am finding that unless I insert a LabVIEW delay (for example a wait for x ms VI) in the loop, the real-time system stops responding. With a small delay (ie 1 ms), t
    he acquisition completes, and a FIFO shuts down the loop of the slow process.
    Why do I need a labVIEW delay in the high-priority loop, when the DLL function call itself is quite slow? Even without a DLL call, I would expect the time-critical VI to interrupt, finish its data acquisition, and shut-down the high-priority thread using its FIFO.
    Any suggestions?
    Thanks in advance,
    Frenk

    Here are a couple things to try/check:
    1) Check the call library node in your high priority VI. If it's orange (runs in UI thread), your high priority VI is actually switching to the UI thread every time your dll runs. That alone is not a problem. But if your TC VI tries to update any control terminals, the TC thread will switch over to the UI thread to access UI resources, possibly while the dll within your high priority VI has a lock on those resources. Why does the dll have a lock on UI resources? Because it was running in the UI thread and got interrupted by the TC thread before it finished doing its business. Not likely, but possible.
    2) There's another possible reason you're seeing this behavior. If the TC VI and the high VI call a mutual subVI, the subVI will be elevated to ALWAYS run in the highest priority thread irrespective of the actual caller (in your case, it's the the TC thread). Even when the *high priority VI* calls the mutual subVI, that subVI runs in the time-critical thread, which means there's a thread switch from high to TC, then back to high after the subVI finishes. And because high and TC VIs are in the same exec system, that mutual subVI will always run in the 1 and only TC thread alotted to that exec system.
    So, while your TC VI is running, you're in the TC thread. While, your high VI is running, you're in a high non-TC thread, and when your high VI calls the mutual subVI, you're again in the TC thread until the subVI finishes.
    So how could this arrangement cause your TC VI to become starved by the high VI? If your TC VI wakes up while the high VI is in the middle of running the mutual subVI, the TC thread responsible for running the TC VI is actually busy (in the middle of running the subVI in your high VI!!!), so the TC thread cannot run your TC VI until it finishes running that mutual subVI.
    The fix: make your TC VI run in a different exec system. It will be given its own TC thread that no one else can mess with. When TC VI wakes up, it's guaranteed a TC thread.
    I think there's a good reason behind why a mutual subVI ALWAYs runs at the highest priority of all its callers, irrespective of the actual caller's priority...but I can't think of the reason at the moment.

  • Can we run script logic at the time of preparing reports.

    Helo Everybody!
    I am new to SAP BPC.
    Can we run script logic at the time of preparing reports.
    Thanks & Regards,
    Satish.

    If you mean, "Can we run script logic at the time of preparing reports" is equivalent to entering data into the report and sending it to the database, then yes, you may run logic as Marcel indicates.  Defualt logic is ALWAYS run for ANY and EVERY set of data that is sent via an input template from the field.  You may also run logic when posting a jOURNAL entry as well.  But be careful....if default logic attempts to perform to MANY or COMPLEX calculations, the time it takes to complete the process may not be in expectations with the users plans.  There is a fine design balance required when planning to run logic at the time of input, as opposed to running in a package or at specific times during the day.
    Hope this helps.

  • Need  the query to calculate the time taken to excute it.

    hi all,
    i need the query to calculate the time taken to excute it.
    for ex:
    select * from emp;
    how much time it will take to give o/p
    Thanks in advance
    satya

    Just to add to what was said - the execution can each time be DIFFERENT as the factors that governs performance are NOT CONSTANT.
    If Oracle has no idea how long the query is going to take before executing it, then how can you and your code know?
    Oracle's CBO estimates the cost (expense) of the query. This is an indication of how expensive a query is - and the more expensive the query, the more resources need to be used, the longer the query will take. The less expensive the query, the fewer resources it need, the faster it will take.
    And that is it. How fast or how slow? Oracle does not know. How much faster a query with a cost of 10,000 versus a query with a cost of 1? Oracle does not know.
    Why? Because the platform is not constant. Just what data is at this exact moment in the db buffer cache? Just how much CPU capacity is available for the new few seconds? Just what will the sustained throughput be of the I/O subsystem and channels for the next minute? Just how many memory pages need to be swapped between cache and memory? Etc. etc.
    All these factors change every single second. So forget about attempting to accurately calculate up-front the time it will take for a query. IT IS NOT POSSIBLE.

  • How to calculate the time to render a JTable?

    Hi all,
    I have a table that is taking quite some time to render after I edit one of its cells.
    I'd like to know the complete amount of time it takes to render all the cells.
    Considering the cells are rendered inside the java classes, I have no clue how can I do that.
    Any help would be appreciated.

    878279 wrote:
    Tried VisualVM and it's really a nice tool. The problem is that it shows only the time for each method to run.Exactly, so if you look at the event queue thread and drill down you can see which method is 'taking quite some time' after you did an edit. Note that you typically need to drill down a bit into the Swing painting stack but ultimate it's end up in the methods you wrote.
    See for example: http://imageshack.us/photo/my-images/827/simplecpusampling.png/ when sampling this program:
    import java.awt.EventQueue;
    import javax.swing.JFrame;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    public class TestCPUSampling {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    DefaultTableModel slowModel = new DefaultTableModel(5, 5) {
                        @Override
                        public Object getValueAt(int row, int column) {
                            try {
                                Thread.sleep(10);
                            catch (InterruptedException e) {
                                e.printStackTrace();
                            return super.getValueAt(row, column);
                    JFrame frame = new JFrame("Test");
                    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    frame.getContentPane().add(new JTable(slowModel));
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.setVisible(true);
    }Obviously Oracle should do something about that horribly slow Thread#sleep() method...
    But if your getValueAt() is called 15 million times, then it's more likely you have a loop like a TableModelListener which modifies the table model when the table model changes.

  • The time on my iphone 5C is constantly changing, regardless of me setting the correct time manually or automatically, all iOS is up to date and phone is not damaged, any ideas?

    The time will stay correct for an hour or so, then jump backwards for no reason. I have tried setting the time manually and automatically and still get the same problem, and have tried with wifi on and off and it still does it. All my software is up to date and tried contacting EE who said to ask Apple. Phone is about 11 months old and have had no previous problems.

    Hi jennehbear,
    Thank you for using Apple Support Communities.
    Your time jumping backwards an hour sounds like an issue with the time zone. Take a look at this article to troubleshoot the issue.
    iOS: Troubleshooting issues with date and time - Apple Support
    Regards,
    Jeff D. 

  • I want to change the time line in Audition CS6 to display a 24hr time

    I have a file I need to aline to a particular time in a 24hr time format. I can see that I can change it many ways to do with music and video but I use Audition for a different purpose. I need to set the time line to display something similar to a 24hr clock so I can edit a file. Is this possbile?

    Ryan, the decimal format in Audition reads mm:ss.ddd where I need it to read hh:mm:ss:ms - and with a repeating 24hr period. Adobe is aware that it's products are used for more than editing design, film and music...it would be nice for them to have something more suitable.
    My solution it to upload the audio file into Premier, add markers where the relevant times are (after calculating the times to a straight time line) and then export to Audition. It's a lot of work for a large number of files.
    If the time line was more adaptable it would have saved me hours of extra work!
    Thanks for your help anyway.

  • Error at the time posting depreciation (AFAB)

    Dear Friends
    At the time of exeuting AFAB (depreciation run) in background and then checking in SM37 I am getting an error message as below
    "Please check possible error messages at the beginning and the end of the posting list".
    Request you all to let me know where I can check the detail error list and also what is the problem in the system i.e why the system is not calculating depreciation? Please suggest the solution at earliest.
    Thanks and Regds
    Rahul Jain

    Hi Rahul,
    Run AFAB in test run and c what all errors r there and rectify them and them only run it in background.
    Regards,
    Kiran

  • Start-up Disc Corrupted all the time

    Start-up Disc Corrupted all the time
    MacBook Pro early 2008 running 10.6.4 and Windows 7.
    My MBP, early 2008, 2.5 GHz, 4GB Memory, HARD Disc 250 GB Hitachi (HTS 542525K9SA00) needs disc repair and erase and reinstall ever 5 days or so. This problem started in 10.6.3 and is continuing in 10.6.4. Which was updated by combo 10.6.4 and backed up with time capsule/time machine.
    Even though it will not start up on Mac 10.6.4 it will still boot up on Windows 7. It will also boot up with the Snow leopard disc and repair. However some times even after the repair it will not boot up and I have to reinstall 10.6 + about 5 times
    I have completely erased and zeroed out and reinstalled twice but I still get the problem about 4 days later. This was necessary because even though the disc was repaired successfully it would still not boot up.
    In reading about Resolving Disk Corruption at http://www.thexlab.com/faqs/repairprocess.html#Anchor-Using-47857
    The article suggests that a 'Bad Sectors' can cause this problem and suggest a complete zeroed out rein install, which I have done, They also recommend the purchase of DiskWarrior or TechTool Pro. Both are around US$95 on line. Which one is the best to purchase?? They say that TechTool Pro can identify a 'Bad Sector'
    The article also suggested Bad sectors can be an early indication of a hard drive that will eventually need to be replaced.
    I have now order a new 320 GB Hitachi HB from USA and it will take about 14 days to arrive. I have also completely erased and reinstalled again, but this time I have not reinstalled window 7.
    I have also reset the power and PRAM a number of times but it made no difference to the problem.
    I have not shut down the MacBook and I am leaving it in sleep mode as the problem really only seems to come about when the MacBook has been shutdown for a day or two.
    I am quite sick of reinstalling. Has anyone else had this problem and is it my HD or software issue???
    I have also reset the power and PRAM a number of times but it made no difference to the problem.
    Best Regards Peterbill

    Gurus - Can you please advice on this. Basically have developed a form and couple of users want to access that but get error " page cannot be displayed" and I figured out the "Start OC4J instance" windows gets closed automatically after some hours.
    so I wanted this OC4J instance to run 24*7 ( always) without closing by itself. Please advice how could I do that.
    Thanks
    Sheik

Maybe you are looking for

  • Dynex mini-DVI to S-video adapter

    I bought a Dynex mini-DVI to S-video adapter with my Macbook and I just tried to use it to plug into my projector via S-video. The resolution of my screen dropped to 800x600 but otherwise nothing happened. I even followed the Max OS X help informatio

  • Error in installing with ECC 6.0

    Ianxsysex.c Error:. 455: CreateProcess (C: \ Document .. 1 \ admini .. 1 \ Local .. 1 \ Te mp \ sapinst_exe.2052.1290847256 \ sapinst.exe ") failed: the system cannot find the file specified. followed by the error. Two iaextract.c: 818: child has sig

  • Purchasing from a military installation Authorized Reseller

    So I bought a iMac from an authorized reseller, the local PX (military store on post), in Dec 2012. The Apple store is an hour drive and the PX is a 5 min walk, I was thinking convenience, plus the price was right. Just a couple weeks ago my mouse we

  • Can't download flash player - 'Disk image not recognized'

    MAC OS X 10.6.8 2,4 GHz Intel Core 2 Duo I'm trying to download and install the lastest adobe flash player but having a little problem. It downloads without any problem but when I come to double click it it comes up with the following warning/error m

  • Grow/Animate Pie Chart

    I've searched high and low on how to do this and can't find anything. Here's the scenario - Lets say you have a pie chart and you want to animate it so that you have 2 sections both at 50%. But you want to show 1 half of the 50% starting at 20% then