Recently Browsing 0 members
No registered users viewing this page.
Went looking for a FIFO queue there are a few examples here on the forum but I didn't like the complexit/lack of flexibility in what I found
The Queue Ive implemented uses a single dimension array set up as a circular buffer
The position and Item Count are stored in an extra slot of the array inside a 'DllStruct'
Convenience Functions are included
FifoQueue_Create($iSlots) ;Initialize the Queue Func FifoQueue_($eFQ, ByRef $aQ) ;For Status Functions - (So you don't have to supply $vOut) Available operations:
$eFQ_Create = 0, $eFQ_Push, $eFQ_Peek, $eFQ_Pop, $eFQ_IsEmpty, $eFQ_IsFull, $eFQ_Count, $eFQ_Empty, $eFQ_IsInit Example (With Debug function)
I'm in the middle of writing a print queue monitor. I would like to be able to run this on our print server to be able to track who's printing large amounts and reduce the effect on the environment.
I've done a fair chunck of it, but I'm finding that it's causing a bit of a load on the CPU. On average the 'spoolsv.exe' process sits at about 15-20% constantly when nothing is happening. I'm wondering if there is a way I can reduce this.
I'm using the following code to access the print queue.
; Connect to Print Queue $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") While 1 $AllPrintJobs = $objWMIService.ExecQuery ("SELECT * FROM Win32_PrintJob") ; Run through Print Jobs For $PrintJob In $AllPrintJobs ; Process any new jobs here Next Sleep (50) WEnd
I've found that I have to catch the job several times in the queue. If I don't I can miss the total number of pages as the jobs spools.
Is there another way of me getting the same information? Does the information go to another location after the print queue?