Thread execution time

I have a logic that creates an XML by iterating through a collection of objects (which in turn has many child collections). When the number of collection becomes more it actually takes too long time to complete the xml generation. So i decided to go for threaded design where i create a thread for each parent collection. For e.g. earlier if i had 10 parent collections it would take 60 secs (6 secs for each). Now after my threaded design i expected it to be at 6 secs for all the 10 collections as all 10 collections are executed parallely. But to my surprise it didn't give me much time difference. It was almost the same time (reduced a little time). Iam wondering what could be wrong?. After creating all my threads say 10 threads for 10 collections iam using JOIN to connect all of them. Any inputs would be greatly appreciated.
TIA.
Balachandar.

It will take the same time since the same amount of work needs to be done regardless of the number of threads used! Unless you have a lot of processors in your system then threads only 'seem' to run concurrently. Even with a multiprocessor system you need a JVM which would take advantage of the extra processors to see any speed increase.

Similar Messages

  • Process and thread execution time

    HI all
    I am doing a project to develop a high level simulation framework. In the project I need to calculate the number of cycles of a snippet of code in a thread. Like
    void func()
    event1():
    int x;
    x = x * x;
    for();
    while();
    exec(numberofcyles)
    event2();
    Here I want to calculate the number of cycles between event1 and event2 and pass these number of cycles to the exec(numberofcycles) which will later on be simulated. I investigated a number of tools like gprof, Dtrace, linux process statistics, rdstc, getrusage(). None of these seems to be very relevent.
    I tried linux process statistics i.e. /proc/<pid>/task/<tid>/stat. I can access the execution time of threads, but all the time I get 0 execution time. What I think that it reads the execution time of threads when it was started. Is there any way to get the updated execution time of thread?
    Any help will be highly appreciated.
    Irfan

    I suggest reposting in the Unix forum here:
    http://discussions.apple.com/forum.jspa?forumID=735

  • Thread execution time problem

    Hi everyone.
    I�m developing an application that creates multiple threads, does certain calculations, and runs a couple programs.
    The problem is: for some reason, the time that takes to run each thread tends to increment as the number of threads increments.
    That is, for 2 threads the time is x for 4 is x + n, and so on.
    I�d checked that every thread is doing the same (with few differences that not influences in a reasonable fashion), and that, skipping the external programs execution, the problem doesn�t exist. Moreover, there are no inter thread communication.
    My questions: there is any way in which I can reduce the amount of time?
              There is some reason for the amount of time the external process called takes to run to increment? (I checked that if I not call those programs the amount of time each thread takes to execute is near 0 millisecs).
              Something like Windows limits the use of a program multiple times, or something like that.(yes i have only tested it in Windows environment, and yes, the external programs i use are posix compliant)
    The actually time is about 120 secs., and I have to cut it to, at least, aprox. 40.
    A thread alone can run in less than 30 secs., in the worst case.
    Thanks in advance.

    Now imagine that most of the tasks involve fetching
    something from the refrigerator. Even if you have
    multiple chefs in the kitchen, they will, unless
    scheduled properly, all be contending to open the
    door and reach inside.I think that could be the case. All the threads are trying to execute the same archive. As far as I remember, a file isn't locked if it is accessed for reading (or executing) only, but, on the other hand, you're right, there is only one refrigerator on this kitchen, and too many chefs.
    Something else attracted my attention about this. When I run my project, there are two things that grow considerably: first the CPU's usage, and second, the amount of memory each of the external process called by my program consumes I think this could be related with my problem.
    Again: I ran my project commenting the calls to Runtime.exec(�command�) and the time dropped significantly. Running normally, the threads tend to increment their time of execution. Lets say the first thread takes to execute X seconds, the nth thread will take X plus M. In the test I ran, the first thread lived for 30 seconds and the last (150th) lived for about 130 seconds. Without the calls to Runtime.exec() the first threads lived for 0 milliseconds and the last(150th) lived for 6 milliseconds. Therefore, the CPU�s overhead for everything else isn�t the problem here, I think.
    I tried something else to discard the problem of the file access:
    I created ten copies of the ping program in a directory other than the system default, and called them �ping1�, �ping2�, and so on.
    Then, I created a program that creates some threads and executes a ping through a call to the program pingN (with Runtime.exec(), again), so each thread will access a different file (the first thread access ping1, the second ping2 �), and so, the bottle neck problem on the file system shouldn�t happen. But that hasn�t changed anything. With the calls to Runtime.exec() the execution time goes to the clouds, and without it, it�s near zero. And neither is fault of the ping, the I set the timeout to 3 seconds and the retries to 4, so the max amount of time it�ll take to execute is about 12 seconds, but it takes 40+-

  • How to get the execution time of a Discoverer Report from qpp_stats table

    Hello
    by reading some threads on this forum I became aware of the information stored in eul5_qpp_stats table. I would like to know if I can use this table to determine the execution time of a worksheet. In particular it looks like the field qs_act_elap_time stores the actual elapsed time of each execution of specific worksheet: am I correct? If so, how is this value computed? What's the unit of measure? I assume it's seconds, but then I've seen that sometimes I get numbers with decimals.
    For example I ran a worksheet and it took more than an hour to run, and the value I get in the qs_act_elap_time column is 2218.313.
    Assuming the unit of measure was seconds than it would mean approx 37 mins. Is that the actual execution time of the query on the database? I guess the actual execution time on my Discoverer client was longer since some calculations were performed at the client level and not on the database.
    I would really appreciate if you could shed some light on this topic.
    Thanks and regards
    Giovanni

    Thanks a lot Rod for your prompt reply.
    I agree with you about the accuracy of the data. Are you aware of any other way to track the execution times of Discoverer reports?
    Thanks
    Giovanni

  • Reduce execution time

    How to reduce the execution time of this code? 
    Loop at porder1.
    SELECT aufnr bstmg hsdat sgtxt bwart charg FROM mseg INTO
    (porder-aufnr,porder-bstmg,porder-hsdat,porder-sgtxt,porder-bwart,
    porder-charg)
                                             WHERE matnr = porder1-matnr AND
                                                   aufnr = porder1-aufnr AND
                                                   werks = porder1-pwerk AND
                                                   ( bwart = '101' OR
                                                     bwart = '102' ).
    Endselect.
    Endloop.
    Regards
    Praju .

    Hi prajwal.
    I would like to suggest,
    It is possible to reduce the time of execution by Increasing the number of fields in the WHERE clause as only those specific number of records are fetched which results in comparatively less execution time.
    Also, SAP has designed such powerfull tools like Transactions - ST05,  ST07, ST30, and many more
    I would like to suggest you a couple of references relating to your case,
    [SDN - Reference for Long execution time during processing of a select query|/thread/477540 [original link is broken];
    [SDN - Reference for Reducing the Execution time of the program - Tools|How can i reduce time of execution;
    [SDN - Reference for solutions to reduce the execution time of a program|How to reduce my query execution time?;
    Hope that's usefull.
    Good Luck & Regards.
    Harsh Dave

  • Execution time of transactions

    Hi,
    I'm a bit confused about a the execution time of transactions in a transaction.
    I just wrote a transaction which calls four other transactions (just for time testing) and I get the following result:
    [INFO ]: Execution Started At: 09:11:37
    [INFO ]: Execution Started At: 09:11:37
    [INFO ]: Execution Completed At: 09:11:37 Elapsed Time was 453 mS
    [INFO ]: Execution Started At: 09:11:38
    [INFO ]: Execution Completed At: 09:11:38 Elapsed Time was 31 mS
    [INFO ]: Execution Started At: 09:11:38
    [INFO ]: Execution Completed At: 09:11:38 Elapsed Time was 109 mS
    [INFO ]: Execution Started At: 09:11:38
    [INFO ]: Execution Completed At: 09:11:38 Elapsed Time was 125 mS
    [INFO ]: Execution Completed At: 09:11:38 Elapsed Time was 1547 mS
    the first 4 time information are from the calles transaction. The last time information is from the "outer" transaction.
    But I just call the 4 transactions and don't do anything else. Why is there such a big time difference? (more then double of time) And how can I solve this problem?
    Thanks
    Matthias

    Jeremy,
    If the box is checked and you only call the TRX action once in your logic flow I don't think it really makes any difference because the runner servlet has to load/parse the file at least once no matter what.
    Do you mean it doesn't make any differences generally or I performance?
    As the "log" shows there is a difference. Even in my original transaktion I feel that it is really faster. But the general results are the same. So I get the same results faster
    Just to be sure: The outer transaction and the transaction will be loaded everytime it is called by a user, webservice or what ever. So if the the transaction is startet twice a the same second in different threads they were also loaded twice?
    And another question: I don't think it is possible to start a new thread in a transaction, is it? Why I'm asking: In my transaction I have some action that shuld be executed immediately and other action that can be done at a later time. (Some updates / inserts in tables and they aren't critical if they fail). So best solution on performance point of view would be if the main thread runs fast and the User gets the result and all other things run after this. Do I have any chance to do so or is something like this planed in future versions of MII?
    I mark this question as answered as my originaly question is answered.
    Thank you.
    Regards,
    Matthias

  • Execution time for the report.

    Dear All,
    How do i determine the execution time of the report?
    If i need to run some program then please do tell me how can i run the program too?
    Thanks..

    Hi,
    The thread below is telling you how to see query statistics in ST03N.
    Re: BEx Query is executed how many times???
    Regards.

  • Report Execution Time

    I'm looking for a way to include the amount of time that a report took to create. I've looked at an option given in an existing thread:
    Re: How to calculate total time taken by a report
    but this method is extremely slow. I already have complaints about execution time and don't need another excuse added that it's taking longer to tell how long it runs. It seems there would a very simple, and quick, way of getting this information. I just want to put the execution time, or maybe just start and end time, on the trailer where I already list all of the parameters that were passed.
    Any help on this would be much appreciated.

    Can someone from Oracle at least tell me if this can be done or not???

  • Measuring execution time

    Hi, I had written a program a while back which was
    simply loading in an xml file, parsing out a few
    tags, and then writing back to the same file. I
    thought of a way the parsing could be made more
    efficient, and it certainly seems to be running faster,
    however I am looking for suggestions on how I could
    prove this?
    Basically I am looking for a tool that could monitor
    the length of time taken for the program to finish, so
    I could do this using both versions of the program using
    a set data set and compare the results.
    Thanks in advance for any ideas/suggestions :)

    It's fun putting subject lines in the search box
    http://search.java.sun.com/search/java/index.jsp?and=ex
    cution+time&phr=&qt=�=&field=title&since=&nh=10&col=
    avaforums&rf=0&Search.x=19&Search.y=7Why limit yourself to 19 results, though? Search all the forums for "execution time" and you get 55,061 results. "Performance testing" yields 36,651 hits. I guess there's an outside chance one of those threads might be helpful, eh?

  • Load images in execution time

    Hi,
    First of all I want to say that my english is not so good, excuse me.
    Well I have got a question with images an icons in java, it's posible to load images in execution that not exist in compiling time? I'm trying to do this but I can't. I think the images in java are integrated in the jars.
    For example :
    setIconImage(new javax.swing.ImageIcon(getClass().getResource("/home/xxx/images/abc.gif")).getImage());
    Imagine that this image only exists at execution time, or this image not exist in the machine (in the project) that I'm compiling, it only exist in the machine I'm executing the jar.
    Thanks to all.

    Of course, the images are loaded in execution time but the images that you want to load must be exists in compilation time, otherwise this is the message that you get in execution time:
    Exception in thread "main" java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(Unknown Source)
    In my opinion the images are inside of the jar, that's I want to say.
    Thanks for the answers.

  • Clustering of SQL query execution times

    In doing some query execution experiments I have noted a curious (to me, anyhow) clustering of execution times around two distinct points. Across about 100 tests each running 1000 queries using (pseudo-)randomly generated IDs the following pattern emerges. The queries were run from Java using all combinations of pooled/non-pooled and thin/oci driver combinations:
         100          *
         90          *
    R     80          *
    u     70          *
    n     60          *
    s     50          *
         40          *                                             *
         30          *                                             *
         20          *                                        *     *     *
         10          *     *                              *     *     *     *     
              0     100     200     300     400     500     600     700     800     900     1000     1100     1200
                                       Time(ms)Where about half of the total execution times cluster strongly about a given (short) time value with a smaller but broader clustering at a significantly slower mark, with zero intermediate values. The last point is the one I find most curious.
    What I would have expected is something like this:
         100          
         90          
    R     80          
    u     70          
    n     60          
    s     50          
         40                              *                         
         30                         *     *     *                    
         20                    *     *     *     *     *     *          
         10          *     *     *     *     *     *     *     *     *     *          
              0     100     200     300     400     500     600     700     800     900     1000     1100     1200
                                       Time(ms)The variables I have tentatively discounted thus far:
    -query differences (single query used)
    -connection differences (using single pooled connection)
    -garbage collection (collection spikes independent of query execution times)
    -amount of data returned in bytes (single varchar2 returned and size is independent of execution time)
    -driver differences (thin and oci compared, overall times differ but pattern of clustering remains)
    -differences between Statement and PreparedStatement usage (both show same pattern)
    I know this is a rather open-ended question, but does the described pattern seem faniliar or spark any thoughts?
    DB-side file I/O?
    Thread time-slicing variations (client or DB-side)?
    FWIW, the DB is 9.2.0.3 DB and the clients are running on WinXP with Java 5.0 and 9i drivers.
    Thanks and regards,
    M

    Further context:
    Are your queries only SELECT queries ?
    Yes, the same SELECT query is used for all tests. The only variable is the bind variable used to identify the primary key of the selection set (i.e. SELECT a.* from a, b, c where a.x = b.x and b.y = c.y and c.pk = ?) where all PKs and FKs are indexed.Do the queries always use the same tables, the same where clauses ?
    Yes, the same tables are always invoked. The where clauses invoked are identical with the excepton of the single bind variable as described above.Do your queries always use bind variables ?
    A single bind variable is used in all invocations as described above.Are your queries also running in single user mode or multi user mode (do you use SELECT FOR UPDATE ?) ?
    We are not using SELECT FOR UPDATEDid something else run on the database/on the server hosting the database on the same time ?
    I have not eliminated the idea, but the test has been repeated roughly 100 times over the course of a week and at different times of day with the same pattern emerging. I suppose it is not out of the question that a resource-hogging process is running consistently and constantly on the DB-side box.Thanks for the input,
    M

  • DLL execution time

    Hello,
    Does anyone know how to reduce the time of calling the DLL file in the LabVIEW RT ? When I call the DLL file in a timed loops, the iteration duration shows that it needs half of a millisecond ( around 0.5 ms) to load the DLL file (inside the DLL file it do nothing just adding x to y and return the sum). Therefore I want to ask does the LabVIEW RT need to reload the DLL file every time in the timed loop?  And how could I reduce the time of calling DLL file?
    PS: the DLL is made by LabWindows CVI with Real time module.
    Thank you,
    Yan

    Thank you Danny, your reply is very helpful for us to understand the mechnism of how LabVEIW RT is running.
    Texas_Diaz wrote:
    Is it necessary to call into the DLL in the Timed Loop?  The timed loop is a...
    It is very time-saving for us to use DLL file to in our project, because we are using a third party PCI card (Beckhoff FC1100 PCI EtherCAT slave card) and it's very convenient for us to manipulate the PCI card by using the C language. Therefore we want to turn this C-language-based program into a DLL and call it in the LabVIEW RT.
    Okay, now that we got that out of the way, there are things you can do to optimize calls to the Call Library Function Node.
    Unless your DLL entry point is deemed "non-thread-safe", and therefore must run synchronous to other calls into the same DLL entry point, NEVER use the default thread - that will use the UI thread, which controls more than just the DLL call.  Always change the thread context to "Run in any thread" so that the "current" thread (or any other ready LabVIEW execution thread) can be used.  This will significantly reduce jitter in your application and prevent certain classes of runtime deadlocks.  You can tell if the Call Library Function Node is set to UI thread or "any thread" by looking at the color of it - it will be Orange if using the "UI" thread, or Yellow if using "any" thread.
    You can prevent a DLL from being loaded / unloaded each execution call by following a few simple programming techniques.  Basically by exposing the DLL path input and reusing the exact same node used to originally load the DLL, if you then call back into that very same node - but this time provide a blank path - the DLL previously loaded in memory will be used instead of reloading a/any DLL again.  This way you're dynamically loading the DLL at runtime and are allowing the node to keep the DLL in memory.
    Keep the DLL call short and sweet.  
    1. Yes, I enable it "Run in any thread", it can save a little execution time by 5-9 us.
    2. By following the provided example, namely loading the dll file dynamically, but the execution stayed unchanged. 
    3. I use a simple DLL file to do the test, so in this simple DLL file, it just execute sum = x + y, which x, y is the input argument and sum is the return value. so I think the DLL file is simple enough.
    But I still have some questions:
    Do you think the performance of the target machine has a profound impact on DLL execution time? Because I use 32bit desktop PC with core 2 duo CPU as the target machine.
    Another question is that: 
    I use the LabWindows CVI to generate the DLL file, do you think the execution time will be same if I use the visual studio to program the DLL file? Actually, I have tried use Visual Studio 2012 to generate a DLL file, but the DLL file cannot run on the LabVIEW real-time target, I think because the DLL files is generated by the Visual studio, therefore it may needs some Microsoft dependency, do you know how to generate the LabVIEW RT- compliable DLL file by using Visual Studio? 

  • Reducing query execution time

    how can we reduce query execution time?which methods we have to follow to optimization?

    which methods we have to follow to optimization?First, read this informative thread:
    How to post a SQL statement tuning request HOW TO: Post a SQL statement tuning request - template posting
    and post the relevant details we need.
    Execution plans and/or TRACE/TKPROF output can help you identifying performance bottlenecks.

  • How to know exact query execution time.

    Hi,
    I want to know what is exact query execution time which excludes network access, constructing results. Please suggest me.
    Thanks in advance,
    Satish.G

    Not sure I know what you really want, but if this is a testing phase sort of thing and you are running on unix, there is the time command.
    If you want something that is part of your application, you can run a timer in a separate Thread - for approximate time.
    If you want more precise time, you can use java.util.Date - it has a method getTime(), which you can use before processing and again after processing and subtract the former from the later.

  • Query runtime vs Query execution time

    Hi,
    I am trying to find the most executed queries (how often queries are executed) in our BI system.
    I got query runtime from Hitlist in st03 Reporting analysis.
    could someone tell me if its same as query execution time or where can I check most executed queries or how often are queries executed.
    thanks

    hi,
    I hope you already installed the statistics.
    You can get lot of details like  which quereis are being used and their history and how many times they executed and by whom , when  and also tells  DB, OLPA, and Frontend times in ST03N in Expert mode
    refer below thread
    Re: BEx Query is executed how many times???
    also refer help - navigate to  BW Statistics MultiProvider Queries
    http://help.sap.com/saphelp_nw04s/helpdata/en/44/10cb9a8f345cf9e10000000a155369/frameset.htm
    hope it helps u
    Thanks
    Edited by: Srinivas on Oct 30, 2008 9:42 PM

Maybe you are looking for