zcalusic / sysinfo

Sysinfo is a Go library providing Linux OS / kernel / hardware system information.
MIT License
527 stars 93 forks source link

Memory info should be more detail ? #12

Open Haraguroicha opened 5 years ago

Haraguroicha commented 5 years ago

Following this below of code block, there only accept/get first BANK information into memory structure (each DMI type 17 record is describe for a single BANK), but there may be use different type of memory model on server memory (e.g. different of clock speed or Bank Locator), there are not always used same memory information

Is there can add a detailed information into Memory structure or add as Memory.Details ?

e.g.:

{
  "memory": {
    "detailed": [
      {
        "bank": 0,
        "size": 8192,
        "speed": 2133,
        "type": "LPDDR3",
        "voltage": 1.2
      }, {
        "bank": 2,
        "size": 4096,
        "speed": 1866,
        "type": "LPDDR3",
        "voltage": 1.2
      }, {
        "bank": 3,
        "size": 4096,
        "speed": 1866,
        "type": "LPDDR3",
        "voltage": 1.2
      }
    ],
    "total_size": 16384
  }
}

https://github.com/zcalusic/sysinfo/blob/9dc8824c92929e7980bbb316345da86f8b1ada58/memory.go#L192-L210

zcalusic commented 5 years ago

Hello @Haraguroicha,

I wasn't even aware that you could have memory banks with different parameters like type, speed, frequency etc... At least, I haven't seen it in the wild, so far.

I do care a lot about simplicity of this library, and compatibility with previous versions. But... I would accept a PR on the topic. I'd also like to hear what other users of the library think?

If you expect me to code it, I must admit it could take a while... quite busy with other stuff...

chendh521 commented 5 years ago

yes, I also hope the memory info could be more detail.

Haraguroicha commented 5 years ago

I pushed a PR as #14