macOS recognizes when it’s been restarted without a proper shutdown or restart operation from the menu. When that happens, you see a dialog at startup that tells you that “Your computer was restarted ...
As with all things, your computer too can collect dust, which can clog its components. Here's how frequently experts suggest you should clean your PC.