Jump to content
Shrinavat

Best way to store and compare PC configuration data

Recommended Posts

Hello everyone,

I'm working on a utility that gathers PC configuration information and displays it in a TTree component. I want to be able to save this information to a file so that it can be compared with a similar file created at a later time. This would allow me to detect any changes in the PC's configuration, such as adding or removing hardware components.

My main challenge is deciding on the best format to store this data for easy comparison and change detection. I've considered options like JSON, XML, and plain text, but I'm unsure which would be most suitable. A simple line-by-line comparison of a text file might not be reliable, as the order of components could change without signifying an actual configuration change (e.g., reordering hard drives).

Could anyone offer advice on the best approach for storing and comparing this type of data? Are there any specific technologies or libraries that would be helpful for this task?

Any guidance would be greatly appreciated!

scr.jpg

Share this post


Link to post

Plain text CSV is my prefered format.

I would make each line with details specific to an item. Order of cells in a line would be in the importance to compare them.

Sort the whole file alpabétically at the end.

Use WinMerge utility to quickly compare the files. Write a dedicated software to read the CSV and make more complex comparison if needed.

 

Example of a line syntax:

Storage, HardDisk, SerialNumber, BrandAndModel, Capacity

 

Example of an actual line:

Storage, HardDisk, 22RKKA0, WDC WD10EZEX, 953667MB

 

  • Thanks 1

Share this post


Link to post
<?xml version="1.0" encoding="UTF-8"?>
<PCConfiguration>
    <System>
        <Brand>Custom Build</Brand>
        <Model>Gaming Rig</Model>
        <DateAssembled>2023-10-15</DateAssembled>
    </System>
    <Hardware>
        <CPU>
            <Model>AMD Ryzen 9 5900X</Model>
            <Cores>12</Cores>
            <Threads>24</Threads>
            <BaseClock>3.7 GHz</BaseClock>
            <BoostClock>4.8 GHz</BoostClock>
        </CPU>
        <Motherboard>
            <Brand>ASUS</Brand>
            <Model>ROG Strix X570-E Gaming</Model>
            <FormFactor>ATX</FormFactor>
            <Chipset>AMD X570</Chipset>
        </Motherboard>
        <RAM>
            <TotalCapacity>32 GB</TotalCapacity>
            <Type>DDR4</Type>
            <Speed>3200 MHz</Speed>
            <Modules>
                <Module>
                    <Capacity>16 GB</Capacity>
                    <Brand>Corsair</Brand>
                    <Model>Vengeance LPX</Model>
                </Module>
                <Module>
                    <Capacity>16 GB</Capacity>
                    <Brand>Corsair</Brand>
                    <Model>Vengeance LPX</Model>
                </Module>
            </Modules>
        </RAM>
        <Storage>
            <Drives>
                <Drive>
                    <Type>SSD</Type>
                    <Capacity>1 TB</Capacity>
                    <Brand>Samsung</Brand>
                    <Model>970 EVO Plus</Model>
                </Drive>
                <Drive>
                    <Type>HDD</Type>
                    <Capacity>2 TB</Capacity>
                    <Brand>Western Digital</Brand>
                    <Model>Blue</Model>
                </Drive>
            </Drives>
        </Storage>
        <GraphicsCard>
            <Brand>NVIDIA</Brand>
            <Model>GeForce RTX 3080</Model>
            <Memory>10 GB</Memory>
            <Type>GDDR6X</Type>
        </GraphicsCard>
    </Hardware>
    <Peripherals>
        <Monitor>
            <Brand>Dell</Brand>
            <Model>U2720Q</Model>
            <Size>27 inches</Size>
            <Resolution>3840 x 2160</Resolution>
        </Monitor>
        <Keyboard>
            <Brand>Logitech</Brand>
            <Model>G915</Model>
            <Type>Mechanical</Type>
        </Keyboard>
        <Mouse>
            <Brand>Razer</Brand>
            <Model>DeathAdder V2</Model>
            <Type>Wired</Type>
        </Mouse>
    </Peripherals>
</PCConfiguration>

 

  • Thanks 1

Share this post


Link to post

I'd be tempted to throw it in a small SQLite database. You could add date/time stamp and add to it over time, then even do queries on it to see history of specific changes or compare with other systems. Then again, maybe that's overkill.

  • Thanks 1

Share this post


Link to post
21 hours ago, FPiette said:

Plain text CSV is my prefered format.

Thank you for the suggestion! Using a sorted CSV file with a dedicated comparison tool sounds like a very interesting and potentially robust approach. I'll definitely explore this option further.

 

19 hours ago, Die Holländer said:

<?xml version="1.0" encoding="UTF-8"?>

Thanks for sharing the XML example. I'm already familiar with saving the configuration in XML format 🙂. However, my main challenge lies in efficiently comparing two XML files to identify meaningful changes. I'm open to suggestions on how to best approach this comparison aspect.

 

16 hours ago, corneliusdavid said:

I'd be tempted to throw it in a small SQLite database.

That's an interesting idea using SQLite. My main concern with a database approach is the unknown and variable number of fields. I'm not sure how to design the database structure to accommodate this and still allow for easy comparison between different snapshots. Could you elaborate on how you envision structuring the database to handle this dynamic nature and facilitate efficient comparisons?

Share this post


Link to post
3 hours ago, Shrinavat said:

Thank you for the suggestion! Using a sorted CSV file with a dedicated comparison tool sounds like a very interesting and potentially robust approach. I'll definitely explore this option further.

Sorted CSV is an easy way to handle comparison you need. And if more advanced comparison is required, you may load the CSV in a SQL database (maybe SQLite) or even use a spreadsheet like Excel if you are comfortable with VBA. Excel can directly load CSV files. Of course you can write your analysis in pure Delphi. You'll easily find a library to load a CSV file in an array in memory. What you shall use depends on your preferences and skills.

Share this post


Link to post
7 hours ago, Shrinavat said:

My main concern with a database approach is the unknown and variable number of fields. I'm not sure how to design the database structure to accommodate this and still allow for easy comparison between different snapshots. Could you elaborate on how you envision structuring the database to handle this dynamic nature and facilitate efficient comparisons?

Your record structure would have a lot of string fields, one for each possible type of data you want to save; it'd also have a DateTime field so you could record when the snapshot of your system was taken. The key is to be consistent in how you store the data; for example, the network adapter information should always be stored in the same field(s) requiring some way of identifying them (or lumping all network adapters in one big memo field, perhaps). I'd probably create a detail table for some fields, like the storage section in your screen-shot above. You could have a field for GUID to identify each disk and then the main table would have a summary of how many disks and the total GB.

 

You could use something like Mitec System Information components to scan your computer every time it booted up and if something changed, add an entry to your database with a new date/time stamp. Later, you could go through and see various changes over time as you scan the records. You could also filter on certain fields to see when something changed. 

 

It's really important that you evaluate what and how often your data will change and what you want to do with it later. If this is a product you're building for others, definitely store it in a database; if it's just a one-time information gathering tool for your self over the next six months as your play around with different hardware configurations, just manually enter stuff into a spreadsheet. It really depends on your usage requirements and how much time you have.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×