News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

SSD saver

Started by jj2007, December 16, 2021, 11:24:32 AM

Previous topic - Next topic

jj2007

*** The legal stuff: use at your own risk ***

Betatesters wanted: the attached little proggie has three functions:
1. alarm clock: edit the time (or click +5), then wait; when the moment is reached, whatever sound file (*.mp3, *.mid, *.wav) is present in the executable's folder will be played with the current volume

2. short notes: right-click on the hours in the big field to toggle between small and full mode; notes (and screen positions) are saved when you exit by holding Shift and clicking the close button

3. SSD watch: right-click on the seconds in the big field to toggle between normal and watch mode

In watch mode you can see which processes write excessively to your hard disk. A typical 256GB SSD can sustain about 40GB per day. There are processes that misbehave; for legal reasons, I won't tell you here who misbehaves. If one of them writes more than 20MB in 10 seconds, that makes it 2*3600*24 or 172GB, which is definitely too much. The program will activate its console window and thus show you who is the culprit. You can then close it or kill it with Task Manager.

The program does not use the registry. To uninstall it, just delete the executable. The source is included below, the *.asc file opens in RichMasm, WordPad or MS Word.

You may get virus warnings, which is not unusual with programs coded in Assembly. See what VirusTotal says about the executable, and/or consult our dedicated sub-forum on false positives.

Crappy AV software uses heuristic scanners, and they shout foul when they see, for example, a pushad/popad sequence, simply because they haven't seen one for a long time in standard C++ executables.

jj2007

Here is an example of the console output. The columns are as follows:
- process ID
- MegaBytes written to disk at date and time
- daily average
- age of process (i.e. when was it started)
- name of the executable

The example demonstrates that Firefox behaves OK most of the time, with a few spikes, but that Thunderbird and WhatsApp desktop go mad every now and then. The proggie alerted me, so I could take action, like changing the active WhatsApp contact, otherwise WA would continue to write at a pace of 2MB/s = 172GB per day. That's tolerable for a platter disk, but it does destroy the SSD in the long run. And the misbehaving applications do so silently, because users rarely open Task Manager to consult the disk writes column.

I have not yet found out what exactly triggers this behaviour with Thunderbird. Once I saw the status bar saying "connected to" without getting an answer from the server, and it wrote like hell to disk while waiting. I could stop it by switching to my secondary account. I filed a bug for Thunderbird, and got friendly advice, but no action so far...

jj2007

New version attached above, with minor changes. Inter alia, a MessageBox that tells the user she/he should not close the console window (because that closes the whole application).

If you ever used SetConsoleCtrlHandler, note that you can prevent a user from closing the console window by pressing Ctrl C, but you cannot prevent closing the console by clicking into the close box. This is by design - thank you, Redmond. Google for CTRL_CLOSE_EVENT SPI_GETHUNGAPPTIMEOUT to understand why.

Vortex

Hi Jochen,

Your alarm clock is nice :thumbsup: It works on Window 7 64-bit.

Those online virus analyzers are very interesting , here is a quick example :

DoNothing3.asm

include     \masm32\include\masm32rt.inc

.code

start:

END start


The result is :

Unsafe , Virus.Mabezat.Dam , ERROR Unable To Scan (corrupt PE File) , MachineLearning/Anomalous.100% , Malware.Heuristic!ET#91% (RDMK:cmRtazocYn5Q7bcR

https://www.virustotal.com/gui/file/4de55e19002513d2ecd1b79fba5a1fafda43b14f84050aed1e5f34c64797a594?nocache=1

jj2007

Quote from: Vortex on December 17, 2021, 06:16:35 AM
Your alarm clock is nice :thumbsup: It works on Window 7 64-bit.

Thanks, Erol. I have been using it for years now. You know what the +5 button is good for? The commercial breaks in tv last 6 minutes here :badgrin:

Some months ago I added a proc that activates the dialog when the notebook is no longer charging (I have problems with my charger, and it's no good when I don't noticed that I am running on battery).

Now it was time to add the disk write watch, because my new machine has an SSD, and WA and TB misbehave...

jj2007

Bugzilla:

jj2006 Reporter    
Comment 26 • 8 hours ago
QuoteThanks, Stans. So this is the explanation by the Windows Club:

"I/O Write Bytes: The number of bytes written in input/output operations generated by the process, including file, network, and device I/Os. I/O Write Bytes directed to CONSOLE (console input object) handles aren't counted."

Good. There is one more notebook on the home network, but it was switched off while I observed the steady 2MB/s flow of writes. Is Thunderbird "calling home"? What other device could there be, apart from the only disk drive in this notebook?

Stans Comment 27 • 7 hours ago
(In reply to jj2006 from comment #26)
QuoteIs Thunderbird "calling home"?
Calling home with data that's over 10 times the size of your profile folder? Why would it call home then write all that data to disk instead of uploading it for whatever reason? Sounds like a conspiracy theory to me.

jj2006 Reporter    
Comment 28 • Just now
QuoteRight, Stans. I was joking because I can't see ANY reason to write 10 times the size of my profile folder to disk or to any other "device". And yet, Thunderbird does exactly that, and nobody here takes it seriously. When and why, no idea: so far, I can't reproduce it. But it does happen. How many users are affected? How many SSDs get slowly destroyed?

Btw WhatsApp Desktop does the same. I tracked it down, more or less, to conversations that include links to web pages (not all of them are affected). About 3MB per second, over 250GB per day. It won't stop by itself, but it does stop when you switch to another conversation without links.

Behind such destructive behaviour, there are programmers who open a file for writing, and allow it do so in a loop.

hutch--

JJ,

Are you sure you don't have some malware running ?

HSE

A "magic" idea: applications are simulating memory!!

No knowledge to say that (naturally  :biggrin:). Just observation: normal memory usage is around 60% and almost nothing is writed. Now with Eclipse running memory usage is 73% and something is writed. Perhaps is prevention for memory shortage after some limit?? 
Equations in Assembly: SmplMath

jj2007

Quote from: HSE on December 18, 2021, 08:47:01 AM
A "magic" idea: applications are simulating memory!!

No knowledge to say that (naturally  :biggrin:). Just observation: normal memory usage is around 60% and almost nothing is writed. Now with Eclipse running memory usage is 73% and something is writed. Perhaps is prevention for memory shortage after some limit??

The working set column shows Firefox with 1.5GB in front, then WhatsApp with a ridiculous 1.24GB (folks, this is a text-based messenger service... :rolleyes:), then Thunderbird with 0.7GB. But the total is only 76% of my 6GB.

jj2007

Version 3 posted above. It's now less intrusive, instead of the big console window (still available with a right-click), there is now a static control that signals e.g. +20MB WhatsApp when some proggie misbehaves.

jj2007

Version 4 posted above is even less intrusive. It pops up only if a process goes havoc, and does not activate itself. Plus, you can specify tolerances in the AlarmClock.ini file. Let me know how it works :cool:

Here are my settings:
short name of executable=MB/10 seconds allowed
firefox.exe=40
whatsapp.exe=8
thunderbird.exe=5


Firefox gets a bit more because it's working hard, so 20-30MB per second is not so unusual.