Skip to content

prefetch.ini

mhtvsSFrpHdE edited this page Oct 11, 2022 · 41 revisions

prefetch.ini

The program has no error detection,
putting wrong value in prefetch.ini will crash the program.

After learned all the syntax, go to Best practice wiki page to see recommended usage.

Basic

Optional

It's fine to not change the default value, even if the value looks pretty strange.

Array

Some setting group used to read multiple values together, called array.

  • Config under this group is key/value pair
  • Key name is not matter, you can add your own
  • One key have one value, for multiple value, add new key for it
  • Can be empty if you don't need, delete all lines under the group.

StringArray

Some setting is multiple values correspond to one key,
often split by comma ,, but may be exceptions exist, though.

Int

1, 2, 3... Numbers with no decimal points.

Bool

Only case-sensitive true or false is suggested value,
you may still try some no guarantee fancy stuff.

Command line arguments

*.ini

When start, type setting file name after prefetch.exe to load different settings.
If no ini provided, default is prefetch.ini.
All ini should place at same folder with prefetch.exe see details below:

>prefetch.exe iexplore.ini

new QSettings(QCoreApplication::applicationDirPath() + "/" + <your value goes here>, QSettings::IniFormat);

PrefetchFolder - Array

Array and:

  • Path splitter must be escaped, like C:\\

ExcludeFolder - Array

Same as PrefetchFolder.

PriorityIncludePattern - Array

Use QRegExp as search method:

QRegExp(<your value goes here>, Qt::CaseInsensitive);

AfterPrefetch - 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

Example1 shows how do you put space in exe path and pass arguments,
a lot things required to escape \" properly.

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 in prefetch.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.

Thread

MaxThreadCount - Int

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.

RescanInterval - Int

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.

PrefetchInterval - Int

Seconds, set to 60 for prefetch every minute.

ReadThreadPriority

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.

Instance

Name

Identify prefetch instance when start multiple instance with different config file.
The value will show in tray icon menu and console title bar.

StartToTray - Bool

Start without console window, you can still re-open console window by Show or hide console window

MinimizeToTray - Bool

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.

TrayMenuMinimalWidth - Int

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.

MaximumBlockCount - Int

How many lines of log output will reserve in RAM.
As a background service, it can generate vast amount of log by time.

Font - Optional

Override Qt default font family. The font name can copy from notepad.exe's font setting.

FontSize - Int

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.

PrintOffset - Int

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.

ZoomLevel - Int

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

Language - Optional

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.

String, but value should be one of the valid, case-sensitive format:

  • en_US
  • zh_CN

MainWindow

Position - StringArray Optional

First value is X, second is Y.
The value decide by Qt by default.

Size - StringArray

First value is width, second is height.
The window can't be resize below size set here.

Resizable - Bool

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.

CustomTrayMenu - Array

Use this config group to add custom tray menu.

Same as AfterPrefetch, so the explorer example is suggest.
Key name is the text to show in tray menu.
When clicked, value will send to run command.

Example:

[CustomTrayMenu]
StartFirefox=explorer Firefox.lnk
ClearRam=explorer Memreduct.lnk

Example with not use custom tray menu:

[CustomTrayMenu]
Clone this wiki locally