I would like to know if there is any way to disable cache while performing read/write API operations in QNX.
I found that a read after a write operation is taking very less time as there is cache involved in fulfilling the operation.
But I would like to know the actual disk performance.
I have seen some functions like cache_fini, CACHE_FLUSH, CACHE_INVAL etc.
Do these functions satisfy my requirements? Please support me by providing sample programs to use CACHE_* functions.
I see in Windows, when opening or creating a file with the CreateFile function, the FILE_FLAG_NO_BUFFERING flag can be specified to disable system caching of data being read from or written to the file. I would like to know about the equivalent of such a functionality in QNX.
I don’t know for sure, but I think the answer is no.
You can adjust the delay of how long dirty pages stay in the cache before they are flushed.
I remember Bill Flowers talking about the QNX 4 Fsys and explain how it could not function without a cache.
While it’s understandable that you might want to measure the actual read latencies, there is no other obvious reason why you would want to disable the cache. You can still reasonably measure the read latencies.
For example:
time dcheck /dev/hd0
This would provide ideal transfer times. Getting something more real world will take a little more imagination.
Ok, thank you for your response.
But I have a doubt.
So are you telling CACHE_FLUSH(), CACHE_INVAL() etc can’t be used from my application to satisfy my requirements,
that is, to find read/write time without involving cache in between?
I haven’t seen any examples on CACHE_* functions. So I am not aware of its
usage too. Please confirm.
We are trying to use ClockCycles() command before and after the execution of read/write command
to measure the cycles and hence calculate time.
My question is how to disable the caching operation in between to know the read/write operation time
inorder to evaluate the disk performance only.
So are you telling CACHE_FLUSH(), CACHE_INVAL() etc can’t be used from my application to satisfy my requirements
Those functions target physical memory cache (i.e. L1,L2)… which is why you pass a “physical address”. They have nothing to do with data that may be “cached” internally by devices or by resource managers like devb-*.
Thank you for your reply.
But I have a doubt.
In Windows, when opening or creating a file with the CreateFile function, the FILE_FLAG_NO_BUFFERING flag can be specified to disable system caching of data being read from or written to the file. The system caching mentioned here also means L1, L2 cache, right?
Sorry if I misunderstood it.
If so, can you provide a sample code on how to use cache_init(), CACHE_* functions from my application program?
I just want to experiment the behaviour of my read/write when these CACHE_* functions are used in my code.
FILE_FLAG_NO_BUFFERING …The system caching mentioned here also means L1, L2 cache, right?
Definitely not. FILE_FLAG_NO_BUFFERING is a “user” flag. L1/L2 cache can only be disabled in a kernel driver - and then only over a specific range of dual-ported (device) memory.
Ok. Thank you for the clarification.
Let me ask you one more doubt.
Is there any utilities in QNX/Momentics IDE equivalent to Performance Monitor
in Windows? Using Windows Performance monitor, we can find many parameters
like Disk read time, Disk write time, Disk write bytes/second, Disk read bytes/second
etc.