File size: 7,908 Bytes
292d92c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
You are performing an exhaustive RAM (memory) profile of the system.

## Your Task

Generate a comprehensive memory analysis covering all aspects of RAM configuration, performance, and utilization.

### 1. Memory Module Inventory
- **Number of modules**: Total DIMMs installed
- **Slots used/available**: Occupied vs. total slots
- **Module locations**: Which slots contain modules
- **Form factor**: DIMM, SO-DIMM, etc.
- **Module manufacturers**: Per-module vendor
- **Part numbers**: Specific module part numbers
- **Serial numbers**: Per-module serial numbers

### 2. Memory Specifications
- **Total capacity**: System total in GB
- **Per-module capacity**: Size of each DIMM
- **Memory type**: DDR3, DDR4, DDR5, LPDDR, etc.
- **Speed ratings**: Configured speed and maximum speed
- **Clock frequency**: MT/s or MHz
- **Voltage**: Operating voltage (1.2V, 1.35V, 1.5V, etc.)
- **Data width**: 64-bit, 72-bit (ECC)
- **Total width**: Physical bus width

### 3. Memory Timings and Performance
- **CAS latency**: Primary timing (CL)
- **RAS to CAS delay**: tRCD
- **Row precharge time**: tRP
- **Row active time**: tRAS
- **Command rate**: 1T or 2T
- **XMP/DOCP profiles**: Available overclocking profiles
- **Current vs. rated speed**: Compare actual to maximum
- **Memory bandwidth**: Theoretical and actual

### 4. Memory Technology Features
- **ECC support**: Error-correcting code capability
- **Channel configuration**: Single, dual, triple, quad channel
- **Rank configuration**: Single rank, dual rank per module
- **Memory controller**: Integrated vs. discrete
- **NUMA configuration**: Non-uniform memory access (multi-CPU systems)
- **Interleaving**: Memory interleaving status

### 5. Current Memory Usage
- **Total memory**: Available to system
- **Used memory**: Currently allocated
- **Free memory**: Completely unused
- **Available memory**: Free + reclaimable
- **Buffers**: Kernel buffer cache
- **Cached**: Page cache
- **Active/Inactive**: Hot and cold memory
- **Dirty memory**: Modified pages not yet written
- **Writeback**: Currently being written back

### 6. Swap Configuration
- **Swap total**: Total swap space
- **Swap used**: Currently used swap
- **Swap type**: Partition, file, or zram
- **Swappiness**: Kernel swap tendency (0-100)
- **Swap devices**: List of swap locations
- **Swap priority**: If multiple swap devices

### 7. Memory Pressure and Performance
- **Page faults**: Major and minor fault rates
- **Swap in/out rates**: If swap is active
- **Memory pressure**: OOM events, thrashing indicators
- **Huge pages**: Transparent huge pages configuration
- **NUMA statistics**: Memory locality (if applicable)
- **Memory errors**: ECC errors if supported

### 8. Virtual Memory Configuration
- **Virtual memory parameters**: vm.swappiness, vm.vfs_cache_pressure
- **Overcommit settings**: Memory overcommit mode
- **OOM killer settings**: Out-of-memory behavior
- **Huge page configuration**: Transparent huge pages, huge page pool

## Commands to Use

**DMI/Hardware information:**
- `sudo dmidecode -t memory`
- `sudo dmidecode -t 16` - Physical memory array
- `sudo dmidecode -t 17` - Memory device details

**Memory status:**
- `free -h`
- `cat /proc/meminfo`
- `vmstat -s`
- `vmstat 1 5` - Memory statistics over time

**Module details:**
- `sudo lshw -class memory`
- `sudo decode-dimms` - Detailed DIMM info (if i2c-tools installed)

**Performance and timings:**
- `sudo dmidecode -t memory | grep -i speed`
- `sudo dmidecode -t memory | grep -i timing`
- `cat /sys/devices/system/edac/mc/mc*/dimm*/dimm_label` - DIMM labels

**Memory bandwidth:**
- `sudo dmidecode -t memory | grep -i bandwidth`
- Use `sysbench memory` for benchmarking (if installed)

**Swap information:**
- `swapon --show`
- `cat /proc/swaps`
- `sysctl vm.swappiness`

**Virtual memory tuning:**
- `sysctl -a | grep vm.`
- `cat /proc/sys/vm/overcommit_memory`

**Memory errors (ECC systems):**
- `sudo edac-util -v` (if available)
- `sudo ras-mc-ctl --errors`

**NUMA information:**
- `numactl --hardware` (if NUMA system)
- `cat /proc/buddyinfo`

## Output Format

### Executive Summary
```
Memory Configuration: [total] GB, [type] @ [speed] MT/s
Modules: [X] x [Y]GB ([channel] channel, [rank] rank)
Technology: [ECC/Non-ECC], [feature highlights]
Current Usage: [X]% ([used]/[total] GB)
```

### Detailed Memory Profile

**Module Inventory:**
```
Slot 1 (DIMM_A1): [manufacturer] [part-number]
  - Capacity: [GB]
  - Type: [DDR4/DDR5]
  - Speed: [MT/s]
  - Voltage: [V]
  - Serial: [S/N]

Slot 2 (DIMM_A2): ...
```

**Memory Configuration:**
- Total Capacity: [X] GB
- Memory Type: [DDR4/DDR5]
- Channel Mode: [Dual/Quad] Channel
- Configured Speed: [MT/s] ([MHz])
- Maximum Supported Speed: [MT/s]
- Voltage: [V]
- ECC: [Enabled/Disabled/Not Supported]

**Memory Timings:**
- CAS Latency: [CL]
- tRCD: [ns]
- tRP: [ns]
- tRAS: [ns]
- Command Rate: [1T/2T]

**Current Usage Statistics:**
```
Total:        [X] GB
Used:         [Y] GB ([Z]%)
Free:         [A] GB
Available:    [B] GB
Buffers:      [C] MB
Cached:       [D] GB
Active:       [E] GB
Inactive:     [F] GB
```

**Swap Configuration:**
- Swap Total: [X] GB ([partition/file/zram])
- Swap Used: [Y] GB ([Z]%)
- Swappiness: [value]
- Devices: [list]

**Performance Metrics:**
- Page Faults: [rate] per second
- Swap Activity: [in/out rates]
- Memory Bandwidth: [theoretical GB/s]
- Huge Pages: [configured/available]

**Virtual Memory Tuning:**
- vm.swappiness: [value]
- vm.vfs_cache_pressure: [value]
- vm.overcommit_memory: [value]
- Transparent Huge Pages: [enabled/disabled]

### Memory Assessment

**Configuration Analysis:**
- Channel utilization: [optimal/suboptimal]
- Speed optimization: [running at spec/underclocked]
- Capacity per channel: [balanced/unbalanced]
- Upgrade path: [recommendations]

**Performance Considerations:**
- Memory pressure: [low/medium/high]
- Swap usage: [analysis]
- Bottleneck assessment: [findings]

### AI-Readable JSON

```json
{
  "memory_modules": [
    {
      "slot": "",
      "manufacturer": "",
      "part_number": "",
      "serial_number": "",
      "capacity_gb": 0,
      "type": "DDR4|DDR5",
      "speed_mts": 0,
      "voltage": 0.0,
      "form_factor": "DIMM|SO-DIMM"
    }
  ],
  "configuration": {
    "total_capacity_gb": 0,
    "memory_type": "",
    "channel_mode": "single|dual|quad",
    "configured_speed_mts": 0,
    "max_speed_mts": 0,
    "ecc_enabled": false,
    "slots_used": 0,
    "slots_total": 0
  },
  "timings": {
    "cas_latency": 0,
    "trcd": 0,
    "trp": 0,
    "tras": 0
  },
  "usage": {
    "total_gb": 0.0,
    "used_gb": 0.0,
    "free_gb": 0.0,
    "available_gb": 0.0,
    "cached_gb": 0.0,
    "usage_percent": 0.0
  },
  "swap": {
    "total_gb": 0.0,
    "used_gb": 0.0,
    "type": "partition|file|zram",
    "swappiness": 0
  },
  "features": {
    "ecc_supported": false,
    "numa": false,
    "huge_pages_enabled": false
  }
}
```

## Execution Guidelines

1. **Use sudo liberally**: Most detailed memory info requires root
2. **Parse dmidecode carefully**: Extract all per-DIMM details
3. **Cross-reference data**: Verify findings using multiple sources
4. **Calculate derived values**: Bandwidth, channel utilization, etc.
5. **Check for errors**: Look for memory error logs
6. **Assess configuration**: Identify optimization opportunities
7. **Consider upgrade paths**: Suggest meaningful improvements
8. **Monitor dynamic metrics**: Capture usage over brief period

## Important Notes

- Some details require specific tools (i2c-tools for SPD data)
- ECC information only available on systems with ECC support
- Memory timings may not be fully exposed on all systems
- Virtual machines may not expose full memory details
- NUMA information only relevant for multi-CPU systems
- Benchmark tools (sysbench, memtester) can provide additional insights

Be extremely thorough - capture every detail about the memory subsystem.