Measuring speed of execution of loops

Hi,
          I wanted to know how to measure the speed of execution of each loop in case of a stached sequence structure. The loop basically has an input for steps for measurement of the Capacitance Voltage characteristics. Now, I was keen to know how do I measure the speed of operation during any particular step. I found something was the Profile VIs but is there any better way to measure the speed of operation? I am attaching herewith the VI that is being used.It has several sub-VIs.But, YOu can just get an idea of what I need by browsing through this VI.
Attachments:
CVWAIT33.VI ‏85 KB

In general, a good timing device is a 3 frame sequence. The first and third frames have a ms counter (from the Time & Dialog palette) and the second has the code. Then, you substract the value in the first frame from the value in the third and you know how many ms it took. The problem is that many things take less than a ms to execute and that is something you can only measure statistically, by running your code many times in a for loop (let's say a million times).
If you want iteration times, you can accomplish the same by using a shift register to keep the value of the ms counter from the last iteration and substract it from the current counter value.
Try to take over the world!

Similar Messages

  • The speed of the "for loop iteration"

    Hi all:
    I have written a short mini program just to test out the speed of a "for loop iteration"
    package generator;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2004</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
      private static long tmp = 0;
      public static int count=0;
      public synchronized long getValue(){
          long value = 0;
        value = 10 * System.currentTimeMillis();
        if(value == tmp){
          value++;
          count++;
        tmp = value;
        return value;
      public static void main(String[] args) {
       for (int i=0;i<1000;i++){
          getValue();
        System.out.println("count is " + count);
    }And i find that on average, count will be a value between 498-500, which probably means that on average the speed of a for loop is around 0.5 ms. But I guess the speed of the "for loop " iteration is also very much CPU dependent, could somebody possibly give me some education on this issue :) ?
    Also, anybody know exactly how System.currentTimeMillis works? For example, how does it get the current time from the OS, etc. let me know.
    Again, Many many thanks...

    Hi all:
    I have written a short mini program just to test out the speed of a "for loop iteration"You will find the overhead of the getValue() call, the increments and most importantly the System.currentTimeMillis() is what you are timing.
        public static void main(String args[])  {
            int ITER = 1000000000;
            long start = System.currentTimeMillis();
            for(int i=0;i<ITER;i++);
            long end = System.currentTimeMillis();
            System.out.println("Iterations per sec="+ITER*1000L/(end - start));
        }Prints the following Iterations per sec=576368876Running on a 1.8 GHz Intel/Windows2000

  • Speeding up an audio loop

    Speeding up an audio loop
    Hi. I am an animator and make my own audio tracks via Logic.
    I had Logic 8 and have upgraded to 9 in the hopes that Flex Time speed would do what I need logic to do.... (but it is a constant speed change and not a gradual change or can it do this???)
    I need European Waltz Long (apples own audio loop) to get faster and faster. The animation is of a merry-go-round that gets faster and faster. Firstly the file needed unlocking and bouncing. Now it seems ok... maybe. How do I get it or any audio to change gradually over time? I tried the tempo option too, but it will not work with audio tracks. or will it? Ideally I thought Pro 9 would use some sort of hyper editor type speed and time curve but cant seem to get it to work. Is it the loop or me? Can Logic do this?
    Anita Sancha
    www.anitasancha.co.uk

    There seems to be a problem with some of the jingles, I have tried out other jingles the jingles section of loops. They dont seem to work all the time..... They seem to be locked over and above my unlocking them in the finder info menus. Even taking the wavs into Audacity and re exporting them. Something is traveling back with them.. a mutant wav apple gene.
    However I have had some luck with using the time tempo curve AND bouncing in place AND using time flex all at the same time!!! But not sure what I did. Sometimes the same loop will also bounce in place and be a different length on the track. Sometimes too when I increase the tempo the track gets longer or does sometimes shorter..
    What have apple done to these jingle loops, so I can't do much with them. Or is it me?

  • How to increase measuring speed of Agilent 34401A

    The process of my program (written in Labview) is:
    1) A control code is automatically generated by the program, and the code is sent to multiplexing circuit (the chips I used are ADG706) through digital port (USB6501 from NI)  then a coresponding channel is selected. (for example code hex0000 selects 1st channle,0001 selects 2nd channel, and so on......)
    2) Multimeter Agilent 34401A measures the current value of this channel, and send this value back to the computer for storage. After this, the program goes back to step 1) for next channel, and this program executes like this.
    The functions mentioed above are all realized, and the program works well, but the problem is the speed is slow. It takes a little more than 1 second to measure one channel, totally I have 2048 channels (32 groups and 64 channels in each group, I used two layers of "for" cycles), and it takes about 32 minutes to finish measure all these 2048 channels, too slow, I'd like to reduce them to 10 minutes.
    I tried to reduce the resolution to 4.5, turn off the autozero function of multimeter, but nothing happens, no change of the speed. Now every time the multimeter measures a channel, it makes a "click" sound, does it mean that every trigger the multimeter only takes one measurement? Is there anyway I can increase the measuring speed? Can I send the multimeter 64 control condes a time, and then let the multimeter takes 64 measurments in one trigger? Is it right? If so, how can I realized it?  If I'm wrong about it, can you give me some solutions?
    Thank you very much! 

    I don't have the manuals with me, but I do have a couple of these in my lab.   There is an internal buffer where you can store (I think) 512 readings.   You can use a digital output to trigger the DMM, and only transfer after every 512 readings (4 times) or perhaps one read per group as you mentioned.  I suggest one read per trigger (you can do many more) since it is easier to synchronize with your channel changes.  I believe the commands are INIT and FETCH?, check your manual.  The two times I know the instrument "clicks" are changing functions and certain range changes.  I suspect in your attempts to speed things up you are sending some config. commands each time.  Configure it once initially and make certain you are only sending measurement related commands during the scan, any config. changes (even if you resend the current value) will likely cost you time. 

  • What sensor should be used to measure speed of motor

    Hi,
    I am using NI PCI-6624 to control the speed of dc motor. I have used "PWM-Counter Output.vi" example to generate PWM pulses to control the input power of motor. I am using "counter output" and "analog input" terminals of PCI-6624. Counter output terminal is used to generate PWM signal and "analog input" terminal will be used as an input from speed sensor.
    Can someone tell me what sensor I can use to measure the speed of motor. Please note that the output of the sensor will be the analog input to PCI6624, so it is essential that speed sensor's output is ANALOG.
    Please help me in this matter and tell me which sensor can be used and from where I can buy it ?
    Thanks

    Ayaz,
    the straight forward low-cost solution for velocity measurements is using a quadrature encoder. With your  DAQ device you could use the second counter of the board to measure the frequency of one phase, but that's jus one option amongst others.
    I haven't come across sensors that output a voltage that is proportional to velocity but expect such a device to be much more expensive and probably less accurate.
    Do you plan to do closed loop velocity control? Are you using Windows or a realtime system?
    Kind regards,
    Jochen Klier
    National Instruments

  • Measuring period in time critical loop

    I have a loop running at 6 ms for all my application code. I need to integrate a measurement for period of a TTL signal into this loop ( connected to my gate input of a 6602) but all the example VI's I have looked at wait for the counter to respond before moving on - This is a problem with the low speed I am looking at, and when the speed is zero ( hence the overcount kicks in). What is the best way for me to measure a period given that I am restrained by my overall loop time. I have set up a VI which looks at the counter every tenth cycle, but I would rather have the data more frequently than this using some sort of 'peek' type buffered approach.

    If I understand correctly, you have a loop that must run continuously irrespective of whether there is a period measurement available. And if there is a period measurement available, you want to use that value in your loop.
    If all that's correct, just put a case selector around Counter Read Buffer in your loop. Only call Counter Read Buffer when there is a period measurement available.
    How will you know when there is a period measurement available? Call Counter Get Attribute, checking "available points" attribute ID.
    Now, your loop must call Counter Get Attribute every time, but that is a small price to pay compared to locking up the loop waiting inside Counter Read Buffer. Let me know if this helps.

  • Measuring speed with incrementa​l single counter

    Hi,
    I need to measure the rotational speed and acceleration of a wheel that has 3 hall sensors on it. I will use only 1 of them en it gives 24 pulses 0-5V for a 360° rotation. How can I measure the speed with only a pulse train. I dont have the Quadric encoder...
    Now I'd like to measure the rotational speed using a counter of some sort, but the software I tried writing for it isnt working.
    Thank you for your help

    Hey Nitch,
    Concerning the measurements errors:
    As you get error when speeding up, it looks like the pulses coming from the hall sensors are to short to get measured by the counter.
    Following the USB-6008 specifications, the pulse needs to have a minimum lenght of 100ns (both in high and low state).
    As a counter is using edges to count the pulses (for USB-6008 only the falling edge) the edges need to comply with the TTL specifications which means that the rise and fall time of the pulse needs to be within the 50ns range. 
    So please have a look at the pulse lenght at higher speeds (are they at least 100ns?) and make sure the pulse comply with the TTL specifications.
     If not you will have to add some additional electronics to reshape the pulses.
    Looking at your program.
    It's not nescesarry to have two loops.  It's very well possible to have two DAQ tasks within the same look.
    Have a look at the Examples which come with LabVIEW --> Exampled Finder --> Hardware Input/Output --> DAQmx --> Synchronization --> Multi-Function.
    There are some examples which so the combination of analog and digital input.
    Anyhow you will have to remove the right while loop as the DAQ Express VI which apparently gives you the "spanning, stroom, gashendel" values will only start once you have done the counter measurements.  I assume that you would like to have the "spanning", "stroom", "gashendel" and"speed" synchronized measured.
    Then you have the choice to log to file during acquisition or after the acquisition.
    If you would like to log on the fly don't use the express VI's, but use the lower lever "File I/O" functions. These are faster (less processor time usage).
    As you VI is written now, the left while loop will only output the lastest counter value measured to the next loop when you click the stop button for example.
    You have to "Enable Indexing" of the m/s output tunnel.  Right click on the tunnel and you will be able to select "Enable Indexing".
    This way the application will automatically create an array and each loop iteration the measured value will be added.  One the measurements have been done you can do analysis and save the data using the full array instead of point by point.
    Again, also bring your "spanning, stroom and gashendel" inputs to the left loop.
    In your right loop you also have a loop counter.
    You can simply use the loop iteraction counter (the square box in the left bottom corner with the i).  This is also counting from 0 and incrementing by 1 each loop iteration.
    Again, you can do this in the left loop and forget the second loop completely.
    Hopes this will bring you a step further.
    Don't hesitate to post the VI itself.  This is always easier to look at than an image.
    This way we can also make some modications and post it back.
    Best regards,
    Joeri
    National Instruments
    Applications Engineering
    http://www.ni.com/ask
    Make our forums great:
    If you like the answer, don't forget to "Kudos!".
    "Accept the Solution" if your question is answered!

  • Digital frequency measurement speed in labview

    I am using a USB 6210 device to measure low frequencies of 50 to 1000 Hz. I need to log the frequency every 50ms. I do this in a while loop in labview using a 1 counter low frequency measurement in labview and saving the data using express VI.Each iteration of the loop takes atleast 60 to 100 ms just to read the frequency inside the loop. How do i increase the speed of measurement in Labview ?
    Solved!
    Go to Solution.

    PraveenB,
    Here is a table of the Counter terminals and related PFI lines.  This can be found in the NI DAQmx Help. (http://digital.ni.com/public.nsf/allkb/CCDFC93878BD8781862570FC00559980?OpenDocument)
    Default NI-DAQmx Counter Terminals
    Counter/Timer Signal
    Default Pin Number
    Signal Name
    CTR 0 SRC
    1
    PFI 0
    CTR 0 GATE
    2
    PFI 1
    CTR 0 AUX
    1
    PFI 0
    CTR 0 OUT
    6
    PFI 4
    CTR 0 A
    1
    PFI 0
    CTR 0 Z
    3
    PFI 2
    CTR 0 B
    2
    PFI 1
    CTR 1 SRC
    4
    PFI 3
    CTR 1 GATE
    3
    PFI 2
    CTR 1 AUX
    4
    PFI 3
    CTR 1 OUT
    7
    PFI 5
    CTR 1 A
    4
    PFI 3
    CTR 1 Z
    2
    PFI 1
    CTR 1 B
    3
    PFI 2
    FREQ OUT
    8
    PFI 6
    When you choose counter 1 in the Create channel VI it automatically reserves the gate which is PFI2.  If you use Counter 0 then PFI 2 will work fine.  Likewise if you use Counter 1 you can use anything but PFI 2.
    Message Edited by Jason_D on 10-24-2008 11:43 AM
    Sincerely,
    Jason Daming
    Applications Engineer
    National Instruments
    http://www.ni.com/support

  • Speeding up execution

    I am working on a MIMO channel emulator. The system has a large number of blocks which have to finish execution within the coherence time of the channel, which is a fraction of a milli second. However due to the complexity of some of the operations, I have had to use Matlab scripts to execute them. Now the entire cblock takes around half a second to run, which is far from my goal. Is the invocation of Matlab slowing down the operation? How do I speed up the execution to finish within the coherence time?
    Thanks

    There are quite a few things you can do to speed up your program.  A factor of 3 to 5 is probably acheivable.  Who knows how much more?
    1. You have some duplicated code and a lot of unnecessary code.
    2. You do a lot of things the hard and slow way.
    3. I do not have Matlab so I cannot test the speed of the scripts.  Since they call Matlab to run the scripts, I suspect the process is slower, even if Matlab can do the calculation faster.
    4. Wires running behind other objects and right to left make a LV program hard to read.
    5. At least one part probably does not work.  The code executes but may not produce the result you expect.
    OK. Specifics.
    1. You have constants 6 and 20 several places in the code.  If your system ever changes you will need to find and change all of them.  It is usually better to have one of each and wire them to all the places used.  No speed penalty but a lot of work troubleshooting if something needs to be changed.
    2a. Using the Continuous Random.vi to generate 1 sample, as an array, then indexing the sample out takes about 3 times longer than using the Random Number (the Dice) from the Numeric palette.  It also produces uniformly distributed random numbers between 0 and 1. There are 8 or 9 of these constructions in your program.  Add about 200 ns each time one is called.
    2b. Express VIs are almost always slower than using LV primitve functions.  The Angle Spread calculation (multiply, add, power of 10) is 260 ns slower on my computer. The Random Delays (ln(x)) is about 250 ns slower.
    2c. Expression nodes are slower than using LV primitve functions.  The simple i+1 in a for loop takes 4.3 ns compared to 1.6 ns for the +1 primitive in the Numeric palette. Calculating the subpath offsets in a Formula Node takes 1 us compared to 280 ns with a case structure. Since it never changes, it should be calculated once, outside the loop. Then the time does not matter but you save a microsecond on every iteration.
    5. The AoD sorting: step 6 involves equality comparison of floating point values.  This will often produce a false value for inputs which may be very close due to the finite representation of numbers in binary. Using the >0 test or In Range and Coerce?, depending on exactly what you are trying to do is probably a better method.
    Lynn

  • Agilent E4980A Measurement Speed and Data Acquisition Speed

    I am using E4980A LCR meter, I need very fast data aquisition unfortunately limited by device own speed with 5.6 ms per measurement which means nearly 178 Hz. I am using usb interface with the software provided by NI, in that program I made some modification taking the reading side of the programme in a while loop .
    To test my speed I start the program count 5s and stop saving the results to an excell file. If I plot the results in a graph while programme is working I have 60 Hz speed. If I don't, then it is 80 Hz which are far below the potential maximum speed of 178 Hz. If my lap top battery is very low then my speed is worse. But with no battery problem, my celeron laptop performance is the same as an i7 laptop.
    Here it is my programme, it is the same provided NI but some modification. What can I do to have higher data acquisiton speed ?
    Probably, USB's speed is not enough but I can not believe that while it can save gigabytes of data in a few min can't take 200 datapoint in 1s. Why can't I have 178 Hz speed now and how can I reach this limit ?
    Regards.
    Attachments:
    Read Measurement.PNG ‏44 KB
    Read Measurement.PNG ‏44 KB

    Instrument communications via serial, USB, Ethernet, GPIB, etc just tend to be slow.  The instrument has to interpret the data, react to it, and then send data back.  That takes time.  A few ms per measurement is quite normal.  One option you might have is you could tell the instrument to take several measurements and then request all of the measurements once it is done.  I haven't looked into the E4980A yet to see if it can do that.
    What exactly are you trying to measure.  There might be better ways to get "fast" readings.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions

  • How to increase the speed of my producer loop?

    Hi,
    I try to monitor two CAN channels and to compare values online. That's why I use a producer loop to collect all CAN messages and a consumer loop to calculate some stuff. But the producer is to slow. The queues of my CANCard are full after some minutes. The queues are already set to maximum.
    The first Channel runs with 500 kBit/s, the second one with 125 kBit/s.
    Should I use two Producer loops or how can I increase the speed of my existing producer?
    How should I handle the different speed of the channels?
    Enclosed screenshots from my VI.
    Thanks,
    Thomas
    Attachments:
    producer.jpg ‏66 KB
    receive.jpg ‏38 KB

    Andy,
    thanks for your support!
    Goal of my project is to measure both CAN channels. Between these channels is a real electronic control unit (ecu) which is able to route CAN messages between the channels. My VI has to check weather the routing works fine or not.
    Each message has an identifier and I kow which messages are routed. That means I have to measure both channels, look for routed messages and compare the data and the timestamp of the messages. I try that in my consumer loop. The data are stored in several 2d arrays. And I have to look for specific data in these arrays. I think the loops over the arrays are to slow. but I have no other chance - I have to buffer the messages somehow and then to compare by their timestamps to find the right order. But that's very difficult because the order of the messages in my producer queue is not ordered by the timestamp...
    If you have any idea how to solve the problem better, let me know - I would be happy!
    Thanks,
    Thomas

  • Using a microphone to measure speed

    My problem is that i am trying to measure the speed of a fan using a microphone with labview, any ideas??????

    And I thought this would be a tough one....
    Input the microphone to your sound card, Run the fan and capture the sound. Send the sound through an FFT. If the microphone is placed near the outside of the blades, facing the output of the fan, you will get a "beat frequency" of the fan blades. This will give you a very low frequency. Divide by the number of blades and 60 and you will get the RPM of the fan.
    What you are trying to do is to isolate the frequency that occurs when a fan blade passes in front of the microphone, compressing the air, pushing the cel of the mic in, then the blade passes, decompressing the air (in relative space of course), pulling the cel out. This is a very strong component of the sound you will measure with the mi
    crophone, and should be very easy to see in the FFT. If you want to get fancy, you can isolate this peak in the FFT, apply the math to convert it to RPM, and output the fan speed.
    Good luck. 'Sounds' like fun...

  • Measurement Results in Execution list box

    Anyideas or reliable procedures on adding measurement results to the existing pass/fail line in the execution display list box ?
    Test Engineering
    Empower RF Systems Inc.

    Hi,
    I guess as long as you put in the preconditions to handle those steps that dont have your extra properties and resize your list box to handle the extra information. You should be alright.
    I have used the example in the Resource Library | TestStand | Step Types | Custom Steps Types - adding limits to the description in the Sequence Display without any problems.
    Ray.
    Regards
    Ray Farmer

  • Measuring speed, both Broadband and LAN

    Hi,
    Can someone please advise me of a reliable method of measuring the speed i'm getting on my broadband.
    I've tried speedtest.net and thinkbroadband
    Speedtest.net showed 94Mb/s with one PC connected to the gigabit port on the homehub when the BT man was here. Now the best I get is about 50, but normally about 25 with the same setup, and other computers on the network drop as low as 12.
    For the LAN PCs, are there any recommended tools I can use to try and figure out what's causing the slowdown?
    For the actual broadband speed, what should I be using to measure this?
    Thanks
    J

    Hi,
    Thanks for the replies,
    Yes, i'm on the FTTP trial.
    Here's my test results from the PC connected directly to the router at 100Mb/s earlier today.
    Test1 comprises of two tests
    1. Best Effort Test: -provides background information.
    Download Speed
    57590 Kbps
    0 Kbps
    106417 Kbps
    Max Achievable Speed
    > Download speedachieved during the test was - 57590 Kbps
     For your connection, the acceptable range of speedsis 12000-106417 Kbps .
     Additional Information:
     IP Profile for your line is -106417 Kbps
    2. Upstream Test: -provides background information.
    Upload Speed
    14759 Kbps
    0 Kbps
    15000 Kbps
    Max Achievable Speed
    >Upload speed achieved during the test was - 14759 Kbps
     Additional Information:
     Upstream Rate IP profile on your line is - 15000 Kbps
    And here's one from just now. I guess we're in to peak time now.
    FAQ
    Test1 comprises of two tests
    1. Best Effort Test: -provides background information.
    Download Speed
    55688 Kbps
    0 Kbps
    106417 Kbps
    Max Achievable Speed
    > Download speedachieved during the test was - 55688 Kbps
     For your connection, the acceptable range of speedsis 12000-106417 Kbps .
     Additional Information:
     IP Profile for your line is -106417 Kbps
    2. Upstream Test: -provides background information.
    Upload Speed
    10372 Kbps
    0 Kbps
    15000 Kbps
    Max Achievable Speed
    >Upload speed achieved during the test was - 10372 Kbps
     Additional Information:
     Upstream Rate IP profile on your line is - 15000 Kbps

  • Measure frequency of Z pulse of an accu coder shaft encoder to measure speed using an 6034 E card

    Hi,
    I would like to measure the speed of a engine which has an accu coder encoder hooked onto it. It provides 3 pulses A, B, and Z. I am using a 6034 E PXI card. I wanted to know if there are any examples/ideas that could help me with this (I am new to the digital programming in Labview). I have moved to NI Daqmx 9.8 recently from the older version which supported legacy codes and hence in process of updating the code. I also want to know if an external clock source is required to do this. this. 
    Solved!
    Go to Solution.

    Hello,
    There are several examples in the NI Example finder (you can get here by going to Help >> Find Examples in a LabVIEW window). You can browse to the encoder examples by going to Hardware Input and Output >> DAQmx >> Counter Input. You should be able to find a few examples that will be helpful. 
    Also, this link is a good resources for getting started using DAQmx: http://www.ni.com/white-paper/5438/en
    Thanks!
    Stephanie S.
    Application Engineer
    National Instruments

Maybe you are looking for

  • Scheduled report gets no data but returns success status

    I have a large scheduled webi report which normally takes 2 hours to run against SAP BW. Sometimes, the report will complete very quickly (within 30 miunutes) and returns success, but there is no data in the report. Is this a WEBI problem  or some so

  • File --- XI --- SOAP scenario

    I have a scenario where I would be reading a input file and invoke a Soap adapter and then get back the response and write to another output file. So, i need to configure two asyncronous file adapters(one for inbound and one for outbound) and one syn

  • 24 bit question

    I am wondering if I select 24 bit for recording, is that a universal setting or does it stay with a particular song? The reason I ask is that I have many songs recorded in GB that are 16 bit, but I'd like to start new LE projects at 24 bit. Will this

  • Ipod won't charge, turn on, or connect to computer

    It 's been doing that since plugging it into a defected outlet, where the wire started heating up, and sparks came out of the outlet. I've tried resetting it but nothing happened, and it is cracked a bit, but has never had any problems before. I know

  • Setting JPanel/JButton size

    I recently wrote a GUI with one JPanel that contained a 4x3 grid of JButtons, each containing a picture that was 112x121 pixels. Using just this one JPanel in the JFrame it worked fine, the buttons were the right size for the pictures because of the