-
Notifications
You must be signed in to change notification settings - Fork 4
prefetch.ini
The program has no error detection,
putting wrong value in prefetch.ini will crash the program.
The program has no built-in values, leave unused values in config file even if not need to modify.
Better to start from edit installed file, or duplicate it instead of start from scratch.
After learned all the syntax, go to Best practice wiki page to see recommended usage.
See Command line arguments if you want to use different ini name for multiple instance.
It's fine to not change the default value, even if the value looks pretty strange.
Some setting group used to read multiple values together, called array.
- CAN BE EMPTY if you don't need, delete all lines under the group.
// Empty example, do not delete group name
[ExcludeFolder]
[PriorityIncludePattern]
- Config under this group is key/value pair
- Key name is not matter, you can add your own, just to be unique
- One key have one value, for multiple value, add new key for it
Some setting is multiple values correspond to one key,
often split by comma ,
, but may be exceptions exist, though.
1
, 2
, 3
... Numbers with no decimal points.
Only case-sensitive true
or false
is suggested value,
you may still try some no guarantee fancy stuff.
Folders to prefetch.
READ FIRST! -> Array
Folders inside PrefetchFolder, but don't want to prefetch.
Same as PrefetchFolder
.
READ FIRST! -> Array
Files inside ExcludeFolder, but still wish to prefetch.
Use QRegExp as search method:
QRegExp(<your value goes here>, Qt::CaseInsensitive);
More at Best practice
READ FIRST! -> Array
These are startup items and will only run once after first prefetch
in order to ensure they're startup in cached environment.
Same as PrefetchFolder
and something to notice:
Example1="C:\Program Files\Mozilla Firefox\firefox.exe" https://www.mozilla.org
Example2=explorer .\Firefox.lnk
Example3=explorer C:\Firefox.lnk
Example1 shows how do you put space in exe path and pass arguments.
Example2 shows a smart way to isolate details from prefetch
:
- Create or copy a lnk shortcut along with
prefetch.exe
- Remove space from lnk name
- Write
explorer .\
before lnk name inprefetch.ini
If you use Task Scheduler, remeber to specify Start in (optional)
under Action,
a folder where prefetch.exe
is stored, or Example 2 will not work for unknown reason.
Start from Windows 10 22H2,
explorer may look for lnk file from start menu or somewhere else,
instead of look from working directory by first.
So specify the path is necessary if you don't use full path.
Example 3 shows Example2 with full path.
Use this config group to add custom tray menu.
Same as StartupItem
, but you need to escape every special character.
Example1=\"C:\\Program Files\\Mozilla Firefox\\firefox.exe\" https://www.mozilla.org
The explorer example is suggest.
Key name is the text to show in tray menu.
When clicked, value will send to Command interface,
just like if these are typed in main window.
Because this is a config, escape character is required, which is main window don't.
To send multiple command at once, insert \n
in between.
Example:
[CustomTrayMenu]
StartFirefox=run explorer .\\Firefox.lnk
ClearRam=run explorer .\\Memreduct.lnk
Rescan=expiresc
RunNow=stop\nstartup // <- Send "stop" then send "startup"
Example with not use custom tray menu:
[CustomTrayMenu]
Skip prefetch if cache unfriendly process are running.
I had an example at issue 6.
Query running process is a platform specific action,
software may bound to certain platform and can't port to another,
so this interface introduced to isolate implementation detail.
For example, tasklist
and its output may only suite for Windows 10 22H2.
Linux user may looking for ps
or anything else.
Before each round of prefetch start,
one or more command defined in SkipProcess
will run,
and collect their stdout.
If one of collected stdout DID NOT begin with AssumeProcess
,
this round of prefetch will be skipped and wait for next PrefetchInterval
.
On Windows 10 22H2, when tasklist
didn't match any process,
stdout should be INFO: No tasks are running which match the specified criteria.
Different than StartupItem
, these command does not support Example2.
Leave empty if you don't need to skip, AssumeProcess
will be ignored.
// Do not start prefetch if The Witcher 3 game are running
witcher3=tasklist /fo csv /nh /fi \"imagename eq witcher3.exe\"
// Do not start prefetch if virtual machine ram > 4000000 KB are running
vmwaregt=tasklist /fo csv /nh /fi \"imagename eq vmware-vmx.exe\" /fi \"memusage gt 4000000\"
Seconds, set to 60 for prefetch every minute.
Of course, the prefetch interval is as long as possible until you hit a lot of cache miss.
You may want to try value from low, then double the value every day to close to the limit.
For example, 90 -> 180 -> 360...
Set to 0 to use all available CPU cores.
Qt will try to set this value automatically.
Hyper-Threading will often double the value of real CPU cores.
However, hard drive may not able to handle too much read thread:
in this case, 2, 4 or 8 threads can faster than 16 threads.
There is no known best value of this setting.
Set when to rescan files from folder.
Example:
- 0 to disable rescan
- 1 to rescan everytime
- 2 and more to rescan every a period of times
After folder scanned, all file path founded will cache to RAM and ini,
so future prefetch no need to scan what files to prefetch again,
but prefetch them directly.
When a prefetch task is done, increase completed task counter.
If completed task greater than or equal to RescanInterval,
file path cache will be erased and rescan from folder.
For files not often change (*.dll, *.exe, etc), set to 0.
For user data, set to 1.
You can create multiple instance for different folder types.
Scan folder can be a really expensive operation,
so non-volatile ini cache is introduced in version 3.0
.
Turn on RescanInterval can dramatically DECREASE performance in some case.
See Access control for more information.
This also means regex will run again on each file if you have PriorityIncludePattern
enabled.
Set to LowestPriority
may help with reduce impact to other running process.
The setting only effect read process but not scan folder.
Currently, I see no necessary to change priority of scan folder.
If you need this feature, create an issue to let me know.
String, but value MUST BE one of the valid, case-sensitive values:
- IdlePriority
- LowestPriority
- LowPriority
- NormalPriority
- HighPriority
- HighestPriority
- TimeCriticalPriority
Notice that there is no InheritPriority
. Qt refuse to accept this value say
QThread::setPriority: Argument cannot be InheritPriority
.
Example:
ReadThreadPriority=LowestPriority
See Qt Thread document for more information.
Size in MB. Greater than 0
to enable read buffer, for example, 64
.
With a buffer, you got both advantages and disadvantages.
I have no knowledge to suggest which one is faster.
When PrefetchFolder approximate >= 2 GB, program may crash, or some files are skipped.
-
true
: Able to prefetch >= 2 GB files -
false
: Files can randomly skip when RAM failed to allocate, or even crash the program
When a file is done prefetch, allocated variable RAM will release.
A bigger file will waste more RAM, because released RAM remains empty.
-
true
: During prefetch process, RAM usage is fixed, not affected by file size
A small read buffer can help to reduce RAM waste only in some case:
If all of your files below 1 MB, enable a 64 MB buffer is completely overkill.
Set to0
instead. -
false
: Depends on file size, waste can happen
Read same file with more than 1 request adds milliseconds to an HDD.
-
true
: Depends on file size and buffer size, multiple read request on same file can happen -
false
: One request a whole file
-
true
: Threads share same variable -
false
: Threads have their own variable, so no sync between cores is required
Unit in milliseconds.
When use startup item and rocket launch at same time,
startup item may not work if code run too fast (with prefetch_performance.exe
):
parent process quit too fast after request start new process.
Increase this value if you meet this situation.
Even 0 will also do the trick on some PC. Reason is unknown.
Identify prefetch instance when start multiple instance with different config file.
The value will show in tray icon menu and console title bar.
Start without console window, you can still re-open console window by Show or hide console window
If set to true, when click on console window title bar minimize button, window will hide.
You can still double-click to hide window if set to false.
Default tray menu may not have enough width space to show custom tray menu text.
Increase this value depending on your key name.
For example, 100
should enough for default tray menu,
but if add an extra menu StartFirefox
, the value may set to 200
or more.
How many lines of log output will reserve in RAM.
As a background service, it can generate vast amount of log by time.
Override Qt default font family. The font name can copy from notepad.exe
's font setting.
Font size, use Qt point size as unit.
Will first divide by 72, then multiply by 96 to generate Qt pixel size.
The value will give to QApplication::setFont()
,
so it will work on everything, not just the console.
When print information to console, scroll to bottom is necessary to view latest information.
Default scroll to bottom will leave two empty line in text view.
The value control how many lines to roll back in order to remove the empty line.
The offset amount can variety depending on font size to get optimal result, so it becomes a config.
DPI scale multiplier, the value effect all UI element size and position.
The value will divide by 100.
-
100
/ 100 = 1x -
150
/ 100 = 1.5x -
200
/ 100 = 2x
Override system language detected by Qt.
If specified translate file not found: try to load system language.
If system language translate file also not found: try to load English translate file.
You need at least 1 valid translate file to run the program.
For example, en_US.
String, but value should be one of the valid, case-sensitive format:
- en_US
- zh_CN
Override default translate file location.
Default is translate
.
Example:
-
TranslateFolder=<your value>
qGuiApplication->applicationDirPath() + "/<your value goes here>/prefetch"
C:\Prefetch\<your value>\prefetch
-
TranslateFolder=foo
qGuiApplication->applicationDirPath() + "/foo/prefetch"
C:\Prefetch\foo\prefetch
First value is X
, second is Y
.
The value decide by Qt by default.
First value is width
, second is height
.
The window can't be resize below size set here.
If set to true
, you can drag on window border to resize.
When resize, most UI element should scale with new size.
If set to false
, window will not respond to resize.
5.0
and above add support to update old version config at ini change,
so you don't need to fresh install or merge change manually anymore.
If you use tools to generate ini automatically,
make sure your config version and config template
match main program version you're gonna to use.
For example, prefetch 5.0
use ConfigVersion=0
,
and 6.0
or above may use ConfigVersion=1
,
6.0
can update from 0
to 1
, but 5.0
does not support version 1
.
Do not put ConfigVersion=1
to prefetch 5.0
install folder.
Config update is one-way from low to high.
prefetch_performance
will not check and update config version.
In this case, use prefetch
to run at least one time and close to trigger config update.