News:

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

Main Menu

Which processes destroy your SSD?

Started by jj2007, May 27, 2022, 07:32:05 AM

Previous topic - Next topic

jj2007

A simple console application showing which processes destroy your SSD by writing unsane amounts of crap to disk. Here is the source:

include \masm32\MasmBasic\MasmBasic.inc
  Init
  .Repeat
        PrintLine String$(3, CrLf$), fDate$(), ", ", fTime$()
        ConsoleColor invert
        Print "ID    bytes written  process       caption"
        ConsoleColor
        Dim any() As QWORD
        For_ ecx=0 To GetProcessArray(?)-1      ; ecx=MbProcID(?)
               movlps xmm0, MbIoc(ecx, WriteTransferCount)
               movlps any(ecx), xmm0
        Next
        ArraySort any(-), orgIndex() As DWORD, fill
        For_ ecx=0 To Min(19, eax-1)
                mov ebx, orgIndex(ecx)
                Print Str$("\n%___i    ", MbProcID(ebx)), Str$("%__________i  ", MbIoc(ebx, WriteTransferCount))
                Print Extract$(MbProc$(ebx), "\", ".", xsRinstrL)
                wPrint At(33) "  ", wRec$(WinFromID$(MbProcID(ebx)))
        Next
        Inkey cfm$("\n\nRefresh or exit (Escape)?")
  .Until eax==VK_ESCAPE
EndOfCode


Ouput on my machine:

26.05.2022, 23:31:05
ID    bytes written  process       caption
1332     4391602980  firefox       Start new topic — Mozilla Firefox
4140     1902056026  app-2
4728      969996715  app-2         WhatsApp
1984      560052097  thunderbird   Inbox - jj2007 - Mozilla Thunderbird
2516      226059486  firefox
4052       89262304  firefox
2780       85336005  firefox
5704       82525832  app-2
4976       63233720  firefox
7500       51990240  firefox
4144       48872432  RichMasm      SomeSource.asc - RichMasm
3856       38203056  firefox
2176       19233120  firefox
6508       13067808  firefox
3404       10475600  firefox
2764        9929379  thunderbird
1500        6465380  app-2
1604        4341948  taskhost
5188        1076637  SumatraPDF    SumatraPDF

Refresh or exit (Escape)?


Note that, in contrast to Task Manager, the window titles are shown (many processes don't have a caption, though).