# BES – Battle Encoder Shirase 1.6.2 (stable) & 1.7.0-alpha for Windows 7/XP/2000

Free software that controls per-process CPU usage: an “active” software CPU cooler.
http://mion.faireal.net/BES/

Nothing fancy. It just throttles CPU-hungry application(s) when asked. I made it simply because I really needed it myself.

BES works on Vista/Win7/etc. too (if necessary, run it in the XP compatible mode — probably not necessary), but perhaps you should run it with the admin privileges (right click > "Run as Administrator").

To Gamers: Adjust the Sleep/Awake Cycle in [Control] so that the video won’t get jumpy/choppy.

Some external sites in other languages that explain how to use BES:

Battle Encoder ShiraseでCPU負荷率を操作して快適なPCライフを!!, CPUの利用率制限ソフト

## Version 1.6.2 (stable) & 1.7.0-alpha – March 15, 2014

### Introduction

(You can check the most up-to-date documents online: http://mion.faireal.net/BES/)

BES is a small tool that throttles the CPU usage of the process you “target”: for instance, you can limit the CPU usage of a process which would use CPU 100%, down to 50% (or any percentage you’d like). With this, you can use other programs comfortably while doing something CPU-intensive in the background.

By limiting the CPU load, you can also cool down your CPU immediately when it happens to get too hot. It’s an “active” software CPU cooler. Conventional soft-coolers save CPU energy by making CPU sleep when it is idle. They passively wait until CPU gets idle. BES is more aggressive: it cools CPU by making the “heating” process slow down, i.e. periodically forcing CPU to be idle for a short time. (But you should install a better hardware cooler if you often need to use BES for this purpose. Actually, the first thing you should try is to remove dust around your heat sink (See below). Active soft-cooling might be an interesting hack, but it's just a workaround after all. On the other hand, if your application uses CPU 100% meaninglessly, let BES do the job!)

Furthermore, BES can hide a window you don’t want to be seen for some reason, without killing the process, and restore the hidden windows again anytime you like.

BES is GPL’ed free software, distributed with (real messy) source code.

BES has a multilingual interface: menu language is switchable between Chinese, Japanese, English, etc.

When minimized, BES is sent to the system tray, as a gray icon when idle, a red icon when active:

Why is it called BES or “Battle Encoder Shirase”? —There’s a long story about this weird name, but basically, it’s a parody of two anime titles: Battle Programmer Shirase and Battle Fairy Yukikaze. “Battle encoder” means a crazy person who doesn’t stop encoding even when the CPU reaches a very high temperature. BES helps them go on by cooling the CPU in a hackish way.

CPU Heat Problem? Well, I assume that some people use BES because otherwise the CPU would get too hot, even causing an emergency shutdown. If so, please first make sure that your CPU heat sink is clean enough... (Read more)

Basically, just unzip the zip wherever you like and run bes.exe. You don’t need to install it. When you don’t need it anymore, just delete the whole folder that you unzipped, and everything will be okay (unless, of course, you put something important in BES's folder by yourself). BES creates .ini files in its folder to save settings; they are safe to delete.

#### Current Version

Ver. 1.6.2 2014-03-15 (March 15, 2014) Stable
[FIX] A few internal bugs.

Ver. 1.7.0-alpha (March 15, 2014) Test Version
[NEW] The “Select a Target” dialog box now has a Task Manager-like list-view, showing also the current CPU load for each process, automatically refreshing itself once every 1.75 seconds. Now you can easily see which process is using CPU much. Based on suggestions by Antonello.
[NEW] Now the control slider (track bar) is also shown in the Target dialog box. You don’t need to open a different dialog box anymore to adjust the percentage. (However, if you prefer the old “Control” dialog box, it’s still there.)

2015-10-22 I posted a newer test version 1.7.0.26. This one can target more than 3 processes.

Ver. 1.6.1 2014-01-11 (January 11, 2014) Previous stable version
It was compiled with VC 2008. Changes from the previous version (1.5.2) include:

• Several bug fixes.
• Optionally, now BES can watch multiple instances of the same target exe (Options | Advanced).
• The “Watch Response Time” options (8/4/2 secs).
• More command-line options for power users: --unlimit, --toggle, etc. Check Help | Command Line Help.
• Optimization: The Target list dialog box opens more quickly (and it is now sorted alphabetically). About 10% less memory usage.

The BES.exe in the subfolder vc6 is a legacy build created with an old compiler. You can try it if the normal BES.exe doesn’t work for you. Most probably you don’t need it. Source code is in src.

Other versions are here: older versions and sometimes newer betas.

#### Older Versions

Starting from version 1.3.x, BES can try to override the security system of Windows so that it can limit httpd.exe (Apache), KService.exe (Kontiki), etc.

Starting from version 1.5.x, you can tweak the sleep/awake cycle (frequency) of BES, in milliseconds. This may be handy for example when you want to throttle a game process while keeping the visual smooth. Try a smaller value like 40 in such a case, instead of the default value, 100. Notice, a 40-millisecond cycle means that the visual can be redrawn, in theory, 25 times a second, allowing a 25-fps movie to play without being jumpy. Do not use a too small value, though (the smaller it gets, the less accurate control you get).

Ver. 1.4.4 2011-12-25
[FIX] Important fix: target list was broken for some users, especially on a 64-bit machine. This is mainly because GetModuleFileNameEx may fail on WoW64 (Thanks to Slawek P.).
Note, better fixes are in v1.5.1. Only minimum fixes were backported to 1.4.x. More specifically, v1.5.1 can almost always show the full path as a File Name.
[FIX] Several bugs. Possible crash.

Ver. 1.4.5 2012-01-26

Ver. 1.5.1-beta 2011-12-25 [NEW] Sleep/Awake Cycle (frequency) in milliseconds is editable (based on suggestions by Marek G.).
[MOD] Several small improvements.

Ver. 1.5.2 2012-01-26
[FIX] Minor bug fixes and minor improvements.

Those are older versions (in case someone needs them). For the current version, see the Download section.

MD5 of bes.exe (Unicode version)
1.7.0[.3]  48709E0392FEAE515984FF202872CFDB
1.6.2      A1F5D84E19CF23704A62363A24831794
1.6.1      47E5D4E50463357E50EEED8F83382DE0
1.4.5      63FF008BA4D02AFC1B3F2140A2C35F8E
1.5.1      DF53140EC7B6413EF710757B77DA5667
1.4.4      93AEB8374B130221A886B6C995346F70
1.4.2      A4FEF53D8214F8E99EF2A3273C7ED227
1.3.8.1    515633588A882F1D6FF4241BC36A0B64
1.3.8      2C80888B389C10D6053C2F6FBFFA6462
1.2.2a     EA3C44599CAC027721F000C996CBA545


### How to Use

1. Run bes.exe. Click [Target...]

NOTE: Maybe you should run it with the admin privilidges (right click > "Run as Administrator").
2. Select the target process you want to throttle, and click [Limit this]. In this picture, the user is going to target VirtualDubMod.exe.

NOTE: The limiter activated by [Limit this] will be automatically canceled when the target process is gone (i.e. the target application is closed). If you would like to throttle its CPU usage even after it is closed and restarted, use [Limit/Watch]. That tells BES to keep “watching” all the processes, and “target” the application you specified as soon as BES finds it restarted. (You can limit up to 3 processes, but currently you can let BES watch only one process.)
4. This is how BES looks like when it is doing its job.

To change how much you limit the time slices given to the target, click [Control...].
5. This is where you can control the throttle(s). How to use it should be self-explanatory.

NOTE: This percentage is always relative. If the target originally used the CPU 80%, and if you set limiter −50%, then the CPU load by the target would be 40%. If the original CPU load increased to 90%, then the result by throttling would be 45%. You might want to set the maximum CPU load in the absolute percentage (e.g. “make it exactly 40% whenever possible”), but BES can't do that; because BES is not controlling the CPU directly in low level, but indirectly limits the “greediness” of the target application (i.e. how often it requests the system to give it a time slice) by forcing the targeted process to periodically sleep for a very short time. What you are actually controlling by setting % here is this “periodically how?” part.
(Nevertheless, if you set it −50%, that application's maximum possible CPU usage would be limited to 50% anyway. Only, this doesn't mean that application is guaranteed to use 50% whenever possible. What is guaranteed is, 50% or less.)

#### “Select Target...” Dialog Box (Process List)

Close: Close this dialog.

Refresh: Refresh the list. When this dialog is opened, BES will gather the information needed to list up all the processes running. If you “refresh,” BES will do the same thing again. It’s like a browser’s reload button, and is useful when a new application is started after you open this dialog (that new application will not be listed until you refresh the list).

Hide: Hide all the windows associated to the selected process. The process is not killed. It’s just that associated windows will get invisible.

Show: Show the windows you hid by “Hide” if the target process is selected in the list. (In other words, you should remember which target you hid. BES actually knows it, but (for security reason) it won’t restore the hidden windows until you explicitly specify the target process.)
NOTE: You can hide a running application, close BES, and restart BES after a long while. Even if you do that, BES still remembers which windows it hid, and will restore them when you click [Show]. However, if the target ends on its own, BES can’t restore its windows (which should be obvious). If you shut down or reboot the system, BES will forget about everything it hid (which makes sense too, as everything ends anyway).

Ask/show: Read the above note. Basically BES can choose the windows to restore automatically and properly. However, when something unexpected happens and things are foobared, you can manually tell BES which windows (related to the selected process) it should show. Using this, you could even force a window that is originally hidden to be shown too (some applications generate unseen windows for various reasons).

List All: The process list is usually not complete. System processes that you are not likely to target—or that you can't target, because of the security restrictions—are not listed by default. [List All] will tell BES to list everything anyway.

Unfreeze: This is just for emergency. I bet this never happens to you, but imagine what would happen if BES crashed just after it made the target sleep and not before it reawakened the sleeping baby (yes, BES is a tool that periodically makes the target sleep for a very short time). The target would then freeze. BES is tested for a long time (from 0.8.x until 1.0 beta 18) and such a thing has never happened even once, but in theory it could happen (you know anything weird and unexpected could happen on Windows). Even if that happens, don't panic: restart BES, open this target dialog, go to the listbox and select the target that is frozen. Then just click [Unfreeze]. This will reset what is called “suspend count” for each related thread, and unfreeze the application in question.
NOTE: “Unfreeze” doesn’t work if the target freezes because of its own bug and BES is not responsible. The only situation “Unfreeze” would work is, when BES crashes itself. As you know too well, many applications freeze/crash on their own, totally unrelated to BES.

Friend: When the item selected in the list is something that you are unlikely to target (i.e. unlikely to be CPU-intensive), you may want to tell BES that it’s CPU-friendly by clicking [Friend]. If you do that, BES recognizes the application in question as friendly, and always put it in the bottom of the list. (You can do that if you’d like to, but it is not something you must do to use BES).

Unknown: This tells BES to treat the selected item neutrally, not as Foe nor Friend. Everything is Unknown by default.
NOTE: There are a few exceptions, such as VirtaulDub.exe. BES knows VD can be very CPU-intensive, and always considers it as a foe (you cannot change that, as it is hard-coded). What is meant by “VD is a foe” here, is “it may make CPU too hot.” Nothing more than that. It doesn’t mean VD is a bad program at all.

Foe: This tells BES to consider the selected item as Foe, i.e. a greedy application that often uses CPU too much, which BES often has to “attack.” Probably you will target the same foe again and again, possibly everyday. Once you tell BES that it’s a foe, BES automatically list it at the very top of the target list so that you can select it quickly. If you “attack” a process, that process will be automatically treated as a Foe from then on.

NOTE: The distinction between Friend, Unknown, and Foe is only in the listing order. BES will “attack” a Foe and a Friend exactly in the same way, once you order BES to target it.

Watch: This is like Limit/Watch, but using this you can target the application that is not running. BES keeps watching it, and if it is started, BES immediately begins to limit its CPU usage.

Snap: Make a detailed list of the processes currently running, and save it as a text file. Might be informative.

Exit: End the BES. You can’t exit if one or more limiters of BES are active. First unlimit all, and you can exit.

Exit anyway: End BES anyway even if it’s active. This is just for emergency, when you must end BES forcefully for some reason. BES is a babysitter that periodically lets the target sleep, and it’s a bad idea to tell it to leave without finishing its job properly. If BES is active, you should first do “Unlimit all.” (Even if told to exit anyway, BES will still try to finish its job gracefully.)

Select target / Unlimit all / Control: Already explained.

Unwatch: Use this when you want BES to stop watching the application after you tell BES to watch it.

Real-time mode: When enabled (ticked), BES demands the system to give it a very high priority (“real-time” is like telling Windows, “Hey, if I tell you to do anything, you do it right away without any delay. Don’t let me wait, okay?”). By doing so, probably BES can start as swiftly as possible even if CPU load is already near 100%. BES is a special kind of application that tries to control the CPU usage when it is already monopolized. Yet BES itself needs to get some time slices (i.e. use CPU a little) to do its job. So giving a special priority to it may make sense. Furthermore, in the real-time mode, BES will lower the process priority of the target. When disabled (unchecked), BES will behave modestly, just like an ordinary application. In reality, this usually doesn’t make any big difference.

Changed in 1.2.1: BES 1.2.1 runs as HIGH_PRIORITY_CLASS in non real-time mode (default). It was NORMAL_PRIORITY_CLASS in ver. 1.2.0 and before. In real-time mode, BES gets REALTIME_PRIORITY_CLASS in every version.

Write log: Tell BES to write a debug log. Might be informative, but usually not needed.

Ukagaka: If you have no idea, don’t bother yourself. Well, simply put, Ukagaka (→ Wikipedia: Ukagaka) is a kind of desktop mascot system. If an Ukagaka or a compatible ghost is running, BES sometimes (but quite rarely) communicates with it. For instance, when you open BES’s about box, the ghost may start chatting and tell you the version information of BES.

### Command Line

The following command line tells BES to watch target.exe, and—when target.exe starts running—throttle its CPU usage so that target.exe will be only allowed to use CPU (100 − percentage) % at most:

"C:\path\to\bes.exe" "D:\path to\target.exe" [percentage] [--minimize]

Optionally, you can use an integer between 1 and 99 as percentage. If percentage is omitted or invalid, the last known valid percentage for target.exe is automatically used (if this is the first time to target target.exe, the default reduction 33% will be applied, unless percentage is specified). Note that, when started from command line, BES will Watch/Limit the target, not just Limit it.

The --minimize option, available since 1.1β7, tells BES to start as minimized (sent to the system tray).

### List of Common Output Messages

Started: OK
Limiter started successfully. (Metaphor: I started babysitting.)
Calm: OK
Limiter is active, and successfully re-scanned the targeted process. No changes were detected in the thread list. (The baby is in the bed. No problem.)
Target Re-Locked On: OK
One or more threads of the targeted process were gone, and/or the targeted process created one or more new threads. BES successfully re-enumerated the thread(s) of the targeted process, and everything is under control again. (The baby fell from the bed, but I put it back there. Problem solved. )
* Unlimited *
Limiter is deactivated. (I returned the baby to its mom.)
Limiter failed to start. The possible reasons include: (1) Windows didn’t let BES access to the targeted process for security restrictions; and (2) the target has been terminated already. (I went to babysitting, but the door is locked and no one answers.)
BES couldn’t find any threads of the targeted process and/or BES couldn’t find the targeted process anymore. Most probably the target has been terminated already. (Uh-oh, the baby is missing.)

If you have any trouble, or if you have any suggestions, bug reports, or comments, you can contact the author at For anti-spam reasons, I may change my contact address any time and I may reply to you using a different mail address, but I will try to write you back anyway.

## Appendix

### CPU Heat Problem? (Added on July 1, 2007)

Well, I assume that some people use BES because otherwise the CPU would get too hot, even causing an emergency shutdown. If so, please first make sure that your CPU heat sink is clean enough, unless your computer is a laptop or something and you cannot open the box. Usually, all you need is at most a screwdriver. Consult the instruction manual of your computer. The box may be heavy, but opening it is very easy, as long as it is supposed to open at all. No special knowledge is required. It's just a box, even though the things that are in it are complicated and delicate. Just make sure to pull the power plug and it's not hot before you open the box. Keep the removed screws in a safe place (if you remove them) and remember their correct places (or take a note), so that you can put them back later. They are tiny and tend to be missing if treated carelessly. You need to open the box and you may also need to remove some more trivial parts to see the heat sink, but don't disassemble the heat sink itself (or anything that looks complicated), unless you know exactly what you are doing.

If you find that your heat sink has gathered dust, which is very likely if you haven't cleaned it before, suck up the dust by using the vacuum cleaner carefully (you should do this periodically). Just vacuuming may be enough, but you might also want to use so-called canned compressed air. It's handy and inexpensive. First switch on your vacuum cleaner, and while sucking the air around the heat sink using your left hand, blow the dust off with canned compressed air using your right hand. This way, you can remove the dust quite completely. (If you don't have canned air, you can use your mouth at your own risk. Be careful not to spit anyway.)

Note that the gas from so-called canned air is not actually air, but some kind of toxic gas (carbon dioxide aka CO2, dimethyl ether (DME) aka methoxymethane, etc.), so use it carefully, and try not to inhale the gas. It's not that toxic (for instance, carbon dioxide is always around you anyway), but inhaling a lot in a short period is not a good idea, obviously. Also note that in some countries, they can still legally sell hydrofluorocarbon (HFC), typically difluoroethane (HFC-152a) and/or tetrafluoroethane (HFC-134a), for this purpose, but you should avoid using them. They are known to be quite strong greenhouse gases, like 100 times worse than CO2, although apparently being ozone-safe (being ozone-safe and being a greenhouse gas are two different things). Especially HFC-134a is a bad one. HFC-152a is not really good either. It's kind of idiotic and self-contradictory to heat up the Earth to solve your heat problem. It's a vicious cycle to break. At least, avoid what can be avoided. Incidentally, some products may also contain what is called a bittering agent (denatonium benzoate) for some complicated reason. Whatever the reason, this thing is VERY bitter, unbelievably, inexpressibly, ridiculously bitter, almost making you vomit instantly, so if it happens to stick to your fingers (for instance, after you air-duster your keyboard), never ever lick your fingers for any freaking reason, but just wash your hands really well. Maybe you shouldn't air-duster your cell phone either.

Canned compressed gas is convenient, but could be dangerous, it might even explode, so read the instruction before using it and keep it out of children's reach.