Dequeue element overhead

When the Dequeue Element function is used, as in the framework "Producer/Consumer Design Pattern (Events)", how often does the function poll the queue?
Does this represent a significant overhead?

Actually, I disagree.
I also see no reason for a Queue to require a contiguous memory space to
store many elements.  Ever heard of linked lists?
If it really is similar to arrays, then the act of adding to the
beginning of a Queue must be significantly less efficient than adding
at the end.  Anyone got a benchmark to test this?
During the last few months people have been posting about how
surprisingly efficient and fast passing data via Queues is.  I
would say that the overhead required to queue or dequeue is negligible.
Of course, if you're queuing a 1MB array every millisecond or so it'll
be a different story, but for "normal" use, it's easily fast enough.
Shane.
Message Edited by shoneill on 09-30-2005 12:28 AM
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

Similar Messages

  • ERROR: Dequeue Element in Acquire Semaphore

    Hi
    I'm working with TS4.1 + LV8.6
    Here's the full error I'm getting:
    A Run-time error has occurred in step: xMCP Alive?
    Sequence: MainSequence
    SequenceFile: R:\HLXC1536\Seq\FCU.seq
    Error Message: Dequeue Element in Acquire Semaphore.vi:1->NI_InternetTK_Core_VIs.lvlib:Telnet
    Read.vi:1->TelnetReadWrite.vi->TelnetReadWrite.vi.ProxyCaller
    Error Code: 1
    Could somebody please give me a hint to what sort of problem I'm looking at?
    The error only shows up when I select to run another UUT (from the preUUT sequence).  If I select no and let the sequential model finish the test, it will not happen on the next run.
    The error itself is in a ReadWrite Telnet vi which works fine.  It happens on the first time it is used after the open telnet vi.  Again, it only happens when I select 'Yes' on the question 'run another UUT'.
    And thought?
    Thanks
    Rafi

    Rafi,
    In your ReadWriteTelnet VI, are you using all four semaphore VIs (obtain semaphore reference, acquire semaphore, release semaphore, release semaphore reference)? or are you passing in the semaphore reference from somewhere else?  Just make sure you are releasing the semaphore properly and the semaphore reference (either in this VI or at the end of your sequence) properly.  The fact that this only happens on the second UUT seems to suggest that there is a problem with your references not being closed properly.
    Eric B.
    National Instruments

  • Command requires GPIB Controller to be Controller in Charge on dequeue element

    I have some funky stuff going on in the attached VI. What the VI does is simply to log data to a text file. It is built up as a state machine. This VI's Create state is called from a mainVI (with the help of named queues). I get more than one error and it seems completely random.The error usually occurs if I stop the mainVI, then starts it again. So the second (or following) times the DP VI is called, I get random errors such as the two below:
    Error 1 occurred at Dequeue Element in DP.vi->PSS.vi
    Possible reason(s):
    LabVIEW:  An input parameter is invalid.
    NI-488:  Command requires GPIB Controller to be Controller in Charge.
     Error 1 occurred at Close File in DP.vi->PSS.vi
    Possible reason(s):
    LabVIEW:  An input parameter is invalid.
    NI-488:  Command requires GPIB Controller to be Controller in Charge.
    Why is this? I don't even have a GPIB controller?
    Solved!
    Go to Solution.
    Attachments:
    DP.vi ‏61 KB

    Siniz wrote:
    blawson, I think you found the error!
    So shift registers only gets uninitialized again if I close the actual VI, and not when I start executing it again? So in reality, they actually behave like real shift registers? I found two solutions to this problem.
    1) To initialize the error shift register with an empty error constant.
    2) To remove the wire from the shift register to the Write to Text File. This works since I always call the Create state first.
    Which one would you recommend?
    Also, what is the reason to keep the typedef strict? I have seen non-strict in other code.
    Generally you should always explicitly initialize your shift registers unless you want to retain the values from one execution to the next. This is required for Action Engines but in most other cases you should use initialized shift registers to avoid side effects like you encountered in this application.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Dequeue element times out even when queue element has new data

    Hi,
    I am using a producer/consumer set up and I am only getting one-iteration from my consumer loop.  I have probed the cluster wire that feeds the enqueue element of the producer and there is a continuous data stream there.  I have a timeout wired to the dequeue element in the consumer loop and have tried different times from 1ms to 1000ms.  It is currently at 25ms.  There has to be something else that is causing this issue, but I am overlooking it.  
    I also tried adding an event handler that would detect a value change in the data.  That didn't do anything.  I have tried to restart my machine to no avail.  I am about to shut down and take the battery out of my laptop and reboot (the act of a man out of options).
    If anyone could help, I would be indebted. 
    P Gnu
    If you want to increase your success rate, double your failure rate.
    Solved!
    Go to Solution.
    Attachments:
    Dequeue Waiting.vi ‏139 KB

    Thanks Javed_H
    I thought that I tried that, but either I didn't or I did it while there was another bug.  At any rate, the time-out on the event handler did fix it.  I appreciate your help.
    The reason I am using an event handler rather than a local variable is because I have been told many, many times that the local variable is somewhat of a hack.  They gave me other reasons, although they escape me now.  I do recognize and agree, however, that the local variable would work.  I'm letting the design asthetics of others dictate my code.
    Thank you for your input,
    P Gnu
    If you want to increase your success rate, double your failure rate.

  • Dequeue   elements from an  apply - queue table

    hi Everyone?
    I'm tried dequeue elements from a queue table. This one, is associated to an apply streams process. I'd wrote this procedure to test a manual dequeue, but this error message appears :
    ORA-25228: timeout or end-of-fetch during message dequeue from STADMIN.Q_APP_SELECTS_FROM_CRM
    The queue is not empty
    Help me please... thank you
    The Procedure code is:
    create or replace procedure str_clean_queue (cola in varchar2, tabla in varchar2, comando in varchar2) is
    next_trans EXCEPTION;
    pragma exception_init (next_trans, -25235);
    no_messages EXCEPTION;
    pragma exception_init (no_messages, -25228);
    dequeueOpt dbms_aq.dequeue_options_t;
    message_properties dbms_aq.message_properties_t;
    message SYS.ANYDATA;
    msgid raw(16);
    newMess boolean;
    lcr SYS.LCR$_ROW_RECORD;
    a number :=0;
    begin
    dequeueOpt.CONSUMER_NAME := 'APP_SELECTS_FROM_CRM';
    dequeueOpt.DEQUEUE_MODE := DBMS_AQ.LOCKED;
    dequeueOpt.NAVIGATION := DBMS_AQ.FIRST_MESSAGE;
    dequeueOpt.VISIBILITY := DBMS_AQ.IMMEDIATE;
    dequeueOpt.WAIT :=10;
    dequeueOpt.MSGID := null;
    newMess:=True;
    while (newMess) loop
    begin
    DBMS_AQ.DEQUEUE (
    queue_name => 'STADMIN.'|| cola,
    dequeue_options => dequeueOpt,
    message_properties => message_properties,
    payload => message,
    msgid => msgid);
    -- analizamos lo que llego en el payload
    lcr := DBMS_STREAMS.CONVERT_ANYDATA_TO_LCR_ROW(message);
    if (lcr.get_command_type = comando AND
    lcr.get_object_name = tabla AND
    lcr.get_object_owner = 'DBADMIN') then
    -- hacer desaparecer el lcr de la cola
    dequeueOpt.DEQUEUE_MODE := DBMS_AQ.REMOVE;
    dequeueOpt.MSGID := msgid;
    DBMS_AQ.DEQUEUE (
    queue_name => 'STADMIN.'|| cola,
    dequeue_options => dequeueOpt,
    message_properties => message_properties,
    payload => message,
    msgid => msgid);
    a:=a+1;
    end if;
    dbms_output.put_line(a);
    exception
    WHEN next_trans THEN
    dequeueOpt.navigation := DBMS_AQ.NEXT_TRANSACTION;
    WHEN no_messages THEN
    dbms_output.put_line(sqlerrm);
    newMess := FALSE;
    end;
    end loop;
    end str_clean_queue;

    Hello,
    as you wrote you already have a code snippet with DBMS_AQ.DEQUEUE of an exception queue.
    Wrap this DEQUEUE in an infinite loop (LOOP ... END LOOP). In order to have this procedure as an autonomous session
    you can start it as a database job:
    DECLARE
       v_jobno NUMBER(6);
    BEGIN
        DBMS_JOB.SUBMIT( v_jobno,
                        'BEGIN <your module>; END;',
                        SYSDATE, NULL );
        COMMIT;
    END;
    /Kind regards,
    WoG

  • Why do i get error 1122 at dequeue element in consumer loop when i hit stop button

    when i hit stop button from vi, the producer loop stops, the consumer loop gets an error and stops without reading all the elements and then my check queue status loop continues to run becuase it never goes to 0.
    Any help?
    Solved!
    Go to Solution.
    Attachments:
    READ SIC AND LOG.vi ‏48 KB

    matt198717 wrote:
    i believe this is what you were talking about.  If youve got any advice or pointers for this VI please let me know.
    1. Your consumer loop should be using the Dequeue Elements.
    2. Your consumer loop should actually be releasing the queue in the STOP case.
    3. There is also no need for the polling to see how many elements are left in the queue.
    4. Your wait in the producer loop shold only be when there is no data in the buffer (you have it in the wrong case).
    5. Do not use the value from the Bytes At Port to tell the VISA Read how many bytes to read.  You tell the VISA Read to read more bytes than you would ever expect the message to be.  Let the termination character stop the read.
    6. Use a VISA read right after intializing your port to sync up your messages.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Serial Port Producer Consumer.png ‏32 KB

  • Dequeue Element Function: If it times out, what value is sent on the "element" wire?

    Hi,
    If you use a Dequeue Element function with a time out and if the function times out, what value is sent on the "element" wire?  Is it the default value for the element type?  Or something else?
    Thanks.
    Solved!
    Go to Solution.

    Yes, it's the default value of the data type. That's the default behavior for any terminal which has undefined behavior (such as what would happen if you try to index a negative element from an array).
    Try to take over the world!

  • How to set the number of elements dequeued?

    Hello All,
    I am relatively new to LabView. I use LabView 8.2 to detect Joystick movement using a set voltage threshold. Totally, I have 6 channels of analog input. The sampling rate is 2 Kilo Hertz with continuous sampling mode (buffer size set to 10 Kilo Samples). I show a visual stimulus on a computer monitor. Within  3 seconds from stimulus onset, the subject has to press the joystick. So I use a while loop that runs until the subject moves the joystick in any direction as detected by crossing of voltage threshold. The while loop was intended to run for a max of 3 sec if joystick was not moved. My intention while using the vi (see below) was to continuously monitor the voltage signal by means of removing voltage data points from the queue by the labview function/vi - "dequeue element". When I dequeue from inside the loop, the dequeue function removes about 100 msec worth of voltage data points ( = 198-201 points; sampling rate -2Khz) from each of the six channels. This creates problem for me because a single dequeue operation takes 40 to 85 msec during which the loop cannot be stopped. This results in miscalculation of the actual time when the joystick was moved.
    Is there a way to set how many data points the dequeue function removes? My goal is to remove about 1-2 msec worth of data points so that the loop can exit within under 5msec of the joystick movement.
    I have attached the screen shots of the subvi's I am using.
    Acquire Response.jpg - the while loop that has the subvi: Access Analog Data Queue
    Access Analog Data Queue.jpg - front panel of the subvi that has the 'dequeue element' function.
    Remove Element.jpg - a case of Access Analog Data Queue.vi showing the 'dequeue element' function
    Sorry for the long message. Any help would be greatly appreciated.
    Thanks
    Mani
    Attachments:
    Remove Element2.jpg ‏135 KB
    Acquire Response1.jpg ‏266 KB
    Remove Element1.jpg ‏135 KB

    Hello Lynn and tst,
    Thanks for your suggestions. I have attached a screen shot of a vi that has the enqueue function. As Lynn pointed out, it was the enqueueing size that was reflected in the size of the dequeueing. I tried various ways to control the enqueue element size in order to control the dequeue element size. Many of my tricks failed. I had set the data acquisition to be continuous at 2kHz with 10Ks buffer size. You may want to look at the attached image of the subvi "Analog Acquisition" while I explain my attempts. The first thing that I noticed was the 'dt' value in the input node of the timed loop which had been set by somebody to 100. I thought that was part of the reason why my dequeue size was always worth 100msec data points. So I changed it to 1 msec. This definitely made a difference in the chunk size of the dequeued element. Now dequeueing removes only data points worth 1 - 5msec. I also noticed that my data reading timer loop(the while loop in "Analog Acquisition" picture) takes about 20 -25 msec instead of the set 1 msec.
    Why does the loop take so long? I have set the 'number of samples per channel' to -1 so that DAQmx read.vi (see it in Analog Acquisition subvi block diagram) can grab whatever data is available currently and put that into the queue. Can this be a reason why the loop takes more than 20 msec? I also tried to set the number of samples per channel to 2. I reasoned that with the sampling rate of 2KHz, 1ms loop should be able to pull 2data points and enqueue them. But it gave me the much-often-seen error code ":Error -200279 occurred at DAQmx Read (Analog 1D Wfm NChan NSamp).vi:1->Timed structure(s): DAQ Loop". I tried various combinations of loop time and number of samples per channel. I get Error-200279 very often. Note that I have several state transitions and only in a couple of them during every cycle of state transitions, I remove elements and flush the data queue (one place where I remove elements is shown in my original message in the picture-'Acquire Response.jpg').
    How do I set the data acquisition loop to enqueue elements for exactly 1 msec or n msec so that I can control my dequeue size?
    Thanks a lot, I am getting really tired of fixing this problem. Please help.
    Mani
    Attachments:
    Analog Acquisition.jpg ‏363 KB

  • Pause a queue when a number of element in dequeue is reached

    Hi Experts,
    I'm new in LabView programming so please don't get rude on me. I have attached a VI that continuously gathers the temperature reading but got stuck on how to implement its flow discussed below:
    A Producer/Consumer is implemented. The producer will enqueue the reading and the consumer will dequeue them.
    When the dequeue elements have reached a required number, say 10, I'd like to pause/stop the enqueue state and compare the 10 elements in the appended array after they have been dequeued. 
    When it's TRUE (all the 10 elements in the appended array holds true), it will take the last dequeued element and fire up an event in the case structure. Then the program will ask the user to start the process again by asking the fluke set and threshold.
    When it's FALSE, it will resume the enqueue/dequeue by removing the first 10 dequeued elements and place the new 10 elements to the appended array.
    Is this possible? Your feedback is very much appreciated.
    Thanks,
    Johnny
    Attachments:
    Comparing Dequeued Elements.vi ‏16 KB

    It sounds like your application is fairly simple, and if you're new to LabVIEW too, I suggest that you don't need a producer-consumer architecture here. Consider a single loop instead. Then you can use a shift register containing an array (which you have already). When it reaches 10 elements, which you can check using the Array Size function, do the comparison and prompt the user if necessary. When you restart, wire an empty array to the shift register, which will clear the array.
    You need to be clearer about what you want to happen. Your code enqueues floating point numbers, but your text says "all the 10 elements in the appended array holds true" - which sounds like a boolean. Also, you are enqueuing an array, but it sounds like you meant to enqueue single elements.

  • VI Fails to send queue elements

    I am trying to use a queue to send data from my pulse train subVI to my main VI.
    After my pulse train completes, I send a TRUE boolean via the 'Enqueue element' which goes to the 'Obtain Queue' and then to the Dequeue Element to acquire and log data.
    I am not sure why the data is only sent the first time, and not consequentially.
    I've tried the same with the Notifier to no awail. I am not sure if this is an issue in my SubVI or my main VI.
    I am not sure if this is correct? Do I need to release the reference or something?
    Thanks!

    belopsky wrote:
    Thanks - I tried that in a while loop, also tried probing the queue prior to it - would this probe list all of the elements queue up?
    If so, the additional elements never enter the queue....
    Probing the queue reference will not show the elements in the queue.
    If you are sure you are not getting more elements in your queue, then it is a problem with your producer loop.  Are you sure that loop isn't waiting for a message in order to do something that would then add an element to your queue?
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Secondary cost element actual data not posted

    Hi Gurus,
    Actually we are posting the actual cost elements data into particular cost cenetr through batch job.upto 12/31/2009 the actual data is showing for the particular secondary cost element(overheads).Only after 01/01/2010 the actual data is not posted for this particular cost element inthat particular cost center.For the remining cost elements into that particular cost cnetr the actual data is posted thru batch job.We checked that particularsecondary cost element,the validity period is upto 31/12/9999.Suggest on this one.
    Thanks in advance
    Jana

    Hi,
    Did you execute overhead allocation processes as from 01/01?
    Regards,
    Eli

  • Cost Center , Cost element , GL Accounts , Cost sheet , Account Assignment

    Dear Experts,
    Please explain what are Cost Center , Cost element , GL Accounts , Cost sheet , cost component and structure, Account Assignment and  how they are interlinked with each other with transactions.
    Thanks,
    Ram

    Dear,
    Cost element : A cost element classifies the organization's valuated consumption of production factors within a controlling area. A cost element corresponds to a cost-relevant item in the chart of accounts.
    Primary cost element: A cost element whose costs originate outside of CO and accrual costs that are used only for controlling purposes
    Secondary cost element: A cost element that is used to allocate costs for internal activities. Secondary cost elements do not correspond to any G/L account in Financial Accounting. They are used only in Controlling and consequently cannot be defined in FI as an account.
    Cost Center: An organizational unit within a controlling area that represents a defined location of cost incurrence.
    GL Accounts : GL Accounts is master data preparation which is assign to chart of accounts.
    Costin Sheet : The costing sheet integrates all elements of overhead costing. In costing sheet calculation base, cost element & Overhead rate & credit are define.
    cost component and structure :
    Cost component - Makes the costs of a material, an activity type, or a process transparent & Groups the costs of a material according to the requirements for material valuation and profitability analysis
    cost component structure : It is use for
    Activity prices for an activity type
    Cost of a process
    Planned cost of a product
    Material costs passed on to material valuation as the standard price or inventory price
    Cost of goods manufactured passed on to Profitability Analysis
    Account Assignment : It's use for direct posting. In this we have to assign GL which is required to post directly.
    GOPAN

  • Dequeue a teststand queue with labview

    Hello,
    I'm trying to dequeue elements since a VI that is running in a Thread independent of the mainsequence (Teststand).
    I :
    1.- Create a Queue.
    2.- Launch the VI in a new trhead (Is a states machine controlated by the queue ).
    3.- Now in TESTStand mainsequence i will like enqueue elements to give orders at VI. Any idea how to do this?
    egards,
    Oriol

    Hi,
    First, the best way is to enqueue a close message so you know it has to close.
    Second, it returns an error when the queue ref is destroyed =>you just need to handle the error! Maybe the easiest way would be to add a failure post step action to your step (in TestStand) and do whatever exit code you need to perform!
    BR,
    Rodéric L
    Certified LabVIEW Architect

  • Sequential simultaneous writing of queue

    Hello everyone, great day.
    I have what should be a very straightforward question.
    I am currently implemented a Producer Consumer-Consumer-Consumer architecture. ( Acquisition loop  >> write acquisition to disk >> read data from disk and process data >> display user display based off data.) In plain English I have a loop created data, a loop storing that data, a loop reading from disk, and a loop displaying a user interface. ( This is not meant to be a real-time application and I am aware of the overhead created by writing and reading from the disk.) Just stick with me on this one.
    So my problem occurs regarding the second loop. This loop is responsible for writing the queued data (produced in the "Acquisition" loop) to disk. The problem is it also, feeds a queue to the "reading from disk" loop. This setup causes a few obstacles.The main obstacle occurs as a result of the nature of LabVIEW queues. The "write to disk" loop only writes one element from the "Acquisition" queue at a time. This usually is not much of a problem, until you take into the account that this loop also determines the execution of the "reading from disk" loop, with the use of queues. As a consequence this loop determines the rate of the next loop, and therefore has potential to slow down the application, and leave a large number of elements in the queue. Furthermore, you must keep in mind I am only queueing about 7MB of data per element, and my HDD has a average write speed of 60MB with a 64MB cache. As a result, of my setup I can only write one element at a time, consequently causing me to only utilize 7/60MB of the bandwidth of my disk.
    My question is; Is there any possible way to have the "write to disk" loop write multiple elements in the queue simultaneously. I'm hoping I can write enough elements simultaneusly that I can utilize my entire 60MB write bandwith and speed up the execution of any sub routines that rely of the data being written to disk.
    I know there are probably better architecture for completing this application, but at the moment I am limited to this architecture. If you have suggestions for other architectures I am more than willing to listen, but ultimatley I am looking for a way to improvise the simultaneus queue reads, and then writing them to disk with my current structure.
    Thanks everyone, I appreciate the help.
    Taylor S. Amarel
    Learning is living.
    Learning is living.
    Co-Founder and CEO of http://3dprintingmodel.com/
    "If we did all the things we are capable of, we would literally astound ourselves."
    -Thomas Edison
    Solved!
    Go to Solution.

    You can put your Dequeue Element function in a For Loop and set N to some number so that you get more than one element from the queue at one time.  Enable indexing and you will have an array of data.  Write the entire array to the disk.  This should speed things up quite a bit.  Don't forget to use shift registers for the error wires and the queue reference in the For Loop, and also put a small delay in the For Loop to prevent 100% CPU usage.
    - tbob
    Inventor of the WORM Global

  • How to check if a physical data channel has data on it

    I am aquiring data continuously and am trying to check if there is data on the physical line, if there is digital data I want it to be passed to the next stage, if there is not I want the data diguarded. Is there a way of checking this digital line for inactivity because  when I suspend the data flow the clock continues to clock and my buffer just fills with empty data.
    Thanks 

    You should get a timeout error from the DAQmx Read if there is no data availalbe.  Are you not getting an error?
    As for your consumer loop, there is no need to check to see if there is data in the queue.  Just call the Dequeue Element.  If there is no data in the queue, then it sleeps until there is data (assuming you don't use a timeout).  It will then pass out the data as soon as it is available.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for

  • Why can't I find the Illustrator CC 2014 toolbar on my screen on Windows 7?

    Why can't I find the Illustrator CC 2014 toolbar on my screen on Windows 7? The screen resolution is 1280 x 1024.

  • How to set up Adobe Printer to save .pdf in folder

    Good morning. I am looking for guidance on how one can set up a virtual "adobe" printer that saves a print job as a .pdf in a specific shared folder. Example: 1. External application creates a print job 2. Print job goes to a pre-named, virtual print

  • Old log files for CC Monitoring

    Dear all, my CC had an error. After stop and restart, the error was gone. The error message was also not displayed any more in RWB CC monitoring. I think these errors are saved in any log / trace file, don't it? But where? In defaultTrace? I had a lo

  • Locked in text field

    I'm setting up a daily calendar using text fields for a person to enter their name in a certain time spot. Is there a way that once their name is in that spot on the calendar it is locked in so that no one else can delete or change it? Thanks for the

  • Fx 5 won't open at all due to incompatebility with Logitech; want older version back

    Whilst updating, I got the message Fx 5 might not work with some program for recognising Logitech hardware. I tested it first on computer 1 - working with the same Logitech mouse as the other PC - and Fx 5 can be opened on that one, not on the other