{"id":21878853,"url":"https://github.com/moduscreateorg/systat","last_synced_at":"2025-07-18T16:37:47.291Z","repository":{"id":143422380,"uuid":"125770105","full_name":"ModusCreateOrg/systat","owner":"ModusCreateOrg","description":"System Status for Mac/Windows/Linux","archived":false,"fork":false,"pushed_at":"2021-11-15T22:37:06.000Z","size":667,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T04:45:18.723Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ModusCreateOrg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license/iostat.cpp","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-03-18T21:40:08.000Z","updated_at":"2023-11-26T16:40:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"92319df9-1e7f-4f24-bd0a-8b32e41860b3","html_url":"https://github.com/ModusCreateOrg/systat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ModusCreateOrg/systat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModusCreateOrg%2Fsystat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModusCreateOrg%2Fsystat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModusCreateOrg%2Fsystat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModusCreateOrg%2Fsystat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ModusCreateOrg","download_url":"https://codeload.github.com/ModusCreateOrg/systat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModusCreateOrg%2Fsystat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265793684,"owners_count":23829180,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T08:13:56.398Z","updated_at":"2025-07-18T16:37:47.262Z","avatar_url":"https://github.com/ModusCreateOrg.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# systat\n__Real-Time System Status for Mac/Linux.__\n\n![Screenshot](../../raw/master/images/screenshot.png)\n\nScreen shot of i3wm on Linux.  Three consoles/terminals in the left column, each \nrunning systat on a different host.  The middle host/systat is a MacOS host.\n\n## Overview\nThis program refreshes the console/terminal/screen once per second and prints\nuseful information about the system resources.  Displayed are:\n\n1) OS and Kernel version\n2) Uptime and Load Average\n3) CPU state (and per core if the console is tall enough)\n4) Memory usage (RAM and Swap), free, buffers, etc.\n5) Disk activity (per device) - bytes/IOs for read/write\n6) Virtual Memory activity - paging, swapping info\n7) Network activity per interface - read/write bytes/second, errors, etc.\n\nThe information printed is more detailed if there are enough lines in the\nterminal to print it.  That is, if you make your console window tall enough, you\nwill get CPU information for every core of your CPU.  Otherwise, you only get\nthe combined CPU state.\n\nIt is based on a Perl script I wrote many years ago for Linux that performs most\nof these functions.  The Perl script requires you to install Term::Screen from\nCPAN.\n\nThe Perl script is loosely based upon the systat -vmstat command for BSD\n(FreeBSD at least).\n\nThe reason I rewrote systat in C++ is to make it portable between MacOS and\nLinux, and to assure it uses a minimal amount of resources itself.  You don't\nwant to be measuring systat performance while diagnosing a busy system!  I also\nadded the networking information, which was absent in the Perl script.\n\n## Building for MacOS\n\nYou can build the MacOS version:\n```\ncd c/mac\nmake\n# to run it:\n./systat\n# to install it:\nsudo make install\n```\n\n## Building for Linux\n\nThe Linux version was built using vim and gnu make/Makefiles.  To build it:\n```\ncd c/linux\nmake\n# to run it:\n./systat\n# to install it:\nmake install\n```\n\n## How it works\n\nBoth MacOS and Linux versions are structured in a similar manner and share the\nclasses in the common/ directory.  Using Makefile build, libcommon.a is built in\ncommon/, otherwise the classes are built and linked in, and no library is built.\n\nOne of the design goals is to make the program build with no prerequisites.  You\nwon't have to install ncurses or any other library.  The Linux version links\nwith no libraries other than the standard C++ ones.  The Mac version has to link\nwith various MacOS frameworks to access the needed APIs.\n\nFor each of the following classes, there is a global singleton instance,\ndeclared in the .cpp file for the class.  I like it better to do:\n```c++\nconsole.println(\"hello, world\");\n```\ninstead of\n```c++\nConsole::println(\"hello, world\");\n```\nand I get to take advantage of the class constructors to initialize it all.\n\nThere are a few platform specific classes in the c/mac/ and c/linux/\ndirectories.  These directories should contain identical filenames/classes.\n\nThe main.cpp file is the main program.  It basically calls each of the platform\nspecific class' update() methods once per second.  It then calls each of the\nplatform specific class' print() methods.\n\nThe platform specific classes contain the business logic to obtain the useful\ninformation that is printed by systat.  It took quite a bit of discovery to\nlearn which /proc files to parse on Linux systems, and what OSX/Darwin API calls\nto make to get the desired information/samples.\n\nThe print() methods take a bool argument \"test\" that if set, the routine only\nreturns the number of lines that would be printed.  This is so the main program\ncan \"fit\" the displayed information to the console, based upon its height.  The\nfit process involves condensing the various output (what the classes would \nprint), so the informatioj00jn printed does fit the console.  It is possible \nto make the console too small - this is a TODO to handle this case.\n\n### Console Class\n\nThe Console class implements an api to address the cursor, control the display\nmodes (e.g. bold, fg/bg colors, etc.), print output (printf format style), and\nclear lines/whole screen.\n\nIt is implemented to use ANSI escape sequences.  This is lightweight, but\nprobably not perfect.  I tested using several terminal programs for Linux and\niterm2 on Mac.  It works fine.\n\nThis satisfies the design goal of not relying on some 3rd party library that\nwould need to be installed as a dependency.\n\nA SIGINT handler is installed to call the console's destructor, which restores\nthe TTY to a sane state (e.g. enable cursor, default fg/bg colors, etc.).\n\nThe program does not do any keyboard I/O or interaction.  To quit the program,\nhit ^C (Control+c).\n\n### Parser Class\n\nThis is only used by the Linux version, which mainly gets system information by\nparsing files in the /proc filesystem.  Parser does a lot of the work, making\nthe business logic for parsing these files rather elegant.\n\n### Log Class\n\nIf you include \"../common/Log.h\" in any of the .cpp/.h files, then there will be\na global logger singleton.  The constructor opens/creates /tmp/systat.log, which\nyou can \"tail -f\" to see debug output.  Logger.println(FORMAT, ...) to print\ndebugging to the log file.\n\n## License\nMIT License\n\n## Credits\nProgrammed by Mike Schwartz for Modus Create.  \nhttps://moduscreate.com\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoduscreateorg%2Fsystat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoduscreateorg%2Fsystat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoduscreateorg%2Fsystat/lists"}