Title: | DECC |
Notice: | General DEC C discussions |
Moderator: | TLE::D_SMITH N TE |
Created: | Fri Nov 13 1992 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 2212 |
Total number of notes: | 11045 |
Hi, I've a customer who's application is not quick--VMS v5.5-2, DEC C v5.3. One of the things they are interested in is, they use a sequential file, format undefined maximum 512 bytes. They fopen this file as RB, and use fread and fseek on it. This application has come from a PC, and they're trying not to change the code too much--less they have to. They ask, if you use fseek, will it be able to work out which disk block to read, and just grab that, or will it have to read in all the blocks till it realises it's got the right one for your offset? I've suggested using buffers on the file, to try and get it all in memory, but they say that doesn't seem to have made much difference. I'm not sure how much testing they've done with it. Thanks & regards, Steve.
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
2184.1 | DECCXL::OUELLETTE | mudseason into blackfly season | Tue May 13 1997 17:26 | 1 | |
I've asked the RTL team for an answer. | |||||
2184.2 | TLE::D_SMITH | Duane Smith -- DEC C RTL | Wed May 14 1997 15:27 | 5 | |
The big performance difference will be in whether these records are fixed or variable length records. Direct access to the proper block will come with fixed length records. Duane | |||||
2184.3 | KERNEL::PULLEY | Come! while living waters flow | Thu May 15 1997 16:30 | 6 | |
His file is:- Record format: Undefined, maximum 512 bytes Record attributes: Carriage return carriage control does that mean it's going to be treated as variable, as there's no format it can make sense of? | |||||
2184.4 | EPS::VANDENHEUVEL | Hein | Sun May 18 1997 05:20 | 34 | |
> Record format: Undefined, maximum 512 bytes > Record attributes: Carriage return carriage control > does that mean it's going to be treated as variable, as there's no > format it can make sense of? In one sense, Undefined is variable, in that you can ask for a variable amount of bytes. You'll get as many bytes as you ask (untill EOF hits). In an other sense tt behaves more like fixed length as you can jump (seek) directly to any place in the file. Unlike variable length records, were one have to find the word-alligned length word, undefiend does not have to find the begining of a record. Wherever you want to read, that's where you will read. Now I do not know what 'value' the DEC C RTL adds to the basic RMS access. It would appear to me that undefined files need no help whatsoever and can be passed straight to the RMS record IO interface, but I suspect the C RTL will do it's own block IO (in order to use less CPU by staying in usermode over reads) unless told otherwise. Thus I suggest you have them try to open with 'ctx=rec'. After that, the file should listen to RMS Multiblock (mbc) and Multibuffer (mbf) params either from open, or from process context such as $SET RMS/SEQ/BLOC=64/BUF=4 to get 4 buffers, 32Kb each to play. To figute out what's going on behing the scenes on your own, I'd use $ANAL/SYST... SET PROC 'test'... SHOW PROC/RMS=(FAB,RAB,BDBSUM) Or $SET FILE/STAT and MONI RMS/FILE=xxx [/ITEM=OPER and/or /ITEM=CACH Let us know... Hein. | |||||
2184.5 | fseek? | KERNEL::PULLEY | Come! while living waters flow | Mon May 19 1997 10:56 | 3 |
If his file was opened ctx=rec, wouldn't that mean fseek gets the start of a record, rather than the exact byte you asked for? | |||||
2184.6 | TLE::D_SMITH | Duane Smith -- DEC C RTL | Mon May 19 1997 11:11 | 7 | |
No. I don't have the reference manual handy, but it does state the types of files that can be positioned at any byte offset and those which can only be positioned at the start of records. Records having characteristics such as fixed length (and maybe limitations on the record terminators) can be positioned on any byte. Duane |