Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Que Size Question

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
DocJC



Joined: 16 Mar 2006
Posts: 83
Location: Cleveland, OH

Posted: 05 December 2006, 16:12 PM    Post subject: Que Size Question Reply with quote

I appreciate everyone's patience in answering "trivial" questions...

Two questions:
I did a Site Search on the keyword GetQueueCount and get 10 hits, the first of which is:
1. [100.00%] ZBasicSysLib - page 141 of 229 available in the queue...
When I click on it it takes me to a page on the command PAUSE, which has nothing to do with ques...
Is the search searching the ZX server, or is it searching my system, which perhaps has several old versions of the references stashed on it here and there?

Followup Question:
As part of debugging I wanted to check several que sizes, to make sure they were adequate, and that the ZX-24 was never held up awaiting another Task to read several values out before it could stuff more values in.
In my initializations I have:
Code:
'Ques:
Public GPSQue (1 to 160) as Byte 'GPS Data Stream Que, Read
Public BTQueTx (1 to 60) as Byte 'Bluetooth Input Que, Write To BT to Transmit
Public BTQueRx (1 to 80) as Byte 'Bluetooth Output Que, Read Into ZX, RF Rx
Public MMCQue (1 to 150) as Byte 'Hold data for MMC Data Card Write routine

In an infinite loop Task, which reads in a GPS data stream, locates the Start of packet(s), ID's them, and processes them, I inserted a couple lines to display the GPS Que size.
My intention was to debug.print the size of the que space available, and for obcessive compulsive completeness, also print the number of characters currently in the que.
I expected the numbers to add up to the total que size, as specified in the original Dim statement, but they don't.
I believe the manual says that GetQueueBufferSize() - GetQueueCount gives the space available within the que. (No pointer overhead).

My total, The slots available + The number of characters in the que = 151, Not 160, as expected, although it at least remains constant.

It would appear that the buffer is much larger than needed, but why do these values not add up the originally dimensioned que size?

Output: (QS, Space Available, # Char in Que)
QS 144 7
QS 148 3
QS 150 1
QS 151 0
QS 148 3

Code:
Code:

Dim QueSize as integer 'Measure Que size, make sure not running out
Dim GQC as integer 'GetQueueCount reading

Call ClearQueue (GPSQue) 'Empty the que for starters, once

Do 'Loop Forever
  GQC = GetQueueCount(GPSQue) 'Read number of char in que
  QueSize = GetQueueBufferSize(GPSQue) - GQC 'Gives size remaining
  debug.print "QS " & CStr(QueSize) & " " & CStr(GQC)
  Call GPSSOP 'Find the GPS SOP
  Call GPSIDP 'ID GPS Packets: RMC, GGA, GSV, and Process them
Loop


Clearly I'm missing something here, but I would appreciate others pointing me in the right direction!

JC
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2493
Location: Portland, OR

Posted: 05 December 2006, 16:35 PM    Post subject: Re: Que Size Question Reply with quote

DocJC wrote:
Is the search searching the ZX server, or is it searching my system, which perhaps has several old versions of the references stashed on it here and there?

The site search returns information from a database compiled by searching the zbasic.net site. It appears that the index is stale and refers to pages that have since been updated. We'll check into what's going on there.

DocJC wrote:
I expected the numbers to add up to the total que size, as specified in the original Dim statement, but they don't. I believe the manual says that GetQueueBufferSize() - GetQueueCount gives the space available within the que. (No pointer overhead).

A queue consists of a data area (whose size is returned by GetQueueBufferSize) plus some control information. The difference between GetQueueBufferSize() and SizeOf(queue) gives the number of bytes of queue management data; currently 9 bytes. This sometimes referred to as the queue overhead.

GetQueueBufferSize() - GetQueueCount() tells you how much space is left in the queue. The left side of that expression gives the size of the data area of the queue and the right side gives the number of bytes that are currently occupied in the data area.

DocJC wrote:
My total, The slots available + The number of characters in the que = 151, Not 160, as expected, although it at least remains constant.
The difference, 9 bytes, is the management information or queue overhead.
Back to top
DocJC



Joined: 16 Mar 2006
Posts: 83
Location: Cleveland, OH

Posted: 05 December 2006, 16:43 PM    Post subject: Reply with quote

Got it.
Thank you, again!
JC
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group