or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

file-system.mdhardware.mdindex.mdnetwork.mdoperating-system.mdprocess-management.mdsystem-info.md

hardware.mddocs/

0

# Hardware Information

1

2

Comprehensive hardware component access including CPU, memory, storage, network interfaces, and sensors with detailed performance metrics.

3

4

## HardwareAbstractionLayer Interface

5

6

The hardware abstraction layer provides access to hardware items such as processors, memory, battery, and disks.

7

8

```java { .api }

9

interface HardwareAbstractionLayer {

10

ComputerSystem getComputerSystem();

11

CentralProcessor getProcessor();

12

GlobalMemory getMemory();

13

List<PowerSource> getPowerSources();

14

List<HWDiskStore> getDiskStores();

15

List<LogicalVolumeGroup> getLogicalVolumeGroups();

16

List<NetworkIF> getNetworkIFs();

17

List<NetworkIF> getNetworkIFs(boolean includeLocalInterfaces);

18

List<Display> getDisplays();

19

Sensors getSensors();

20

List<UsbDevice> getUsbDevices(boolean tree);

21

List<SoundCard> getSoundCards();

22

List<GraphicsCard> getGraphicsCards();

23

}

24

```

25

26

## Computer System Information

27

28

Physical hardware information including BIOS/firmware and motherboard details.

29

30

```java { .api }

31

interface ComputerSystem {

32

String getManufacturer();

33

String getModel();

34

String getSerialNumber();

35

String getHardwareUUID();

36

Firmware getFirmware();

37

Baseboard getBaseboard();

38

}

39

40

interface Firmware {

41

String getManufacturer();

42

String getName();

43

String getDescription();

44

String getVersion();

45

String getReleaseDate();

46

}

47

48

interface Baseboard {

49

String getManufacturer();

50

String getModel();

51

String getVersion();

52

String getSerialNumber();

53

}

54

```

55

56

## Central Processor (CPU)

57

58

Represents the entire CPU including physical packages, cores, and logical processors.

59

60

```java { .api }

61

interface CentralProcessor {

62

ProcessorIdentifier getProcessorIdentifier();

63

long getMaxFreq();

64

long[] getCurrentFreq();

65

List<LogicalProcessor> getLogicalProcessors();

66

List<PhysicalProcessor> getPhysicalProcessors();

67

List<ProcessorCache> getProcessorCaches();

68

long getSystemCpuLoadBetweenTicks(long[] oldTicks);

69

double getSystemCpuLoad(long delay);

70

double[] getProcessorCpuLoadBetweenTicks(long[][] oldTicks);

71

double[] getProcessorCpuLoad(long delay);

72

long[] getSystemCpuLoadTicks();

73

long[][] getProcessorCpuLoadTicks();

74

int getLogicalProcessorCount();

75

int getPhysicalProcessorCount();

76

int getPhysicalPackageCount();

77

long getContextSwitches();

78

long getInterrupts();

79

80

class ProcessorIdentifier {

81

String getVendor();

82

String getName();

83

String getFamily();

84

String getModel();

85

String getStepping();

86

String getProcessorID();

87

String getIdentifier();

88

boolean isCpu64bit();

89

}

90

91

class LogicalProcessor {

92

int getProcessorNumber();

93

int getPhysicalPackageNumber();

94

int getPhysicalProcessorNumber();

95

int getNumaNode();

96

int getProcessorGroup();

97

}

98

99

class PhysicalProcessor {

100

int getPhysicalPackageNumber();

101

int getPhysicalProcessorNumber();

102

String getIdString();

103

int getEfficiencyClass();

104

}

105

106

enum TickType {

107

USER, NICE, SYSTEM, IDLE, IOWAIT, IRQ, SOFTIRQ, STEAL, GUEST, GUEST_NICE

108

}

109

}

110

```

111

112

## Memory Information

113

114

System memory including RAM, virtual memory, and physical memory modules.

115

116

```java { .api }

117

interface GlobalMemory {

118

long getTotal();

119

long getAvailable();

120

long getPageSize();

121

VirtualMemory getVirtualMemory();

122

List<PhysicalMemory> getPhysicalMemory();

123

}

124

125

interface VirtualMemory {

126

long getSwapTotal();

127

long getSwapUsed();

128

long getVirtualMax();

129

long getVirtualInUse();

130

long getSwapPagesIn();

131

long getSwapPagesOut();

132

}

133

134

interface PhysicalMemory {

135

String getBankLabel();

136

long getCapacity();

137

long getClockSpeed();

138

String getManufacturer();

139

String getMemoryType();

140

String getPartNumber();

141

String getSerialNumber();

142

}

143

```

144

145

## Storage Devices

146

147

Hard disks and storage device information.

148

149

```java { .api }

150

interface HWDiskStore {

151

String getName();

152

String getModel();

153

String getSerial();

154

long getSize();

155

long getReads();

156

long getReadBytes();

157

long getWrites();

158

long getWriteBytes();

159

long getCurrentQueueLength();

160

long getTransferTime();

161

List<HWPartition> getPartitions();

162

long getTimeStamp();

163

boolean updateAttributes();

164

}

165

166

interface HWPartition {

167

String getIdentification();

168

String getName();

169

String getType();

170

String getUuid();

171

long getSize();

172

int getMajor();

173

int getMinor();

174

String getMountPoint();

175

}

176

177

interface LogicalVolumeGroup {

178

String getName();

179

Map<String, Set<String>> getLogicalVolumes();

180

Set<String> getPhysicalVolumes();

181

}

182

```

183

184

## Network Interfaces

185

186

Network interface information and statistics.

187

188

```java { .api }

189

interface NetworkIF {

190

String getName();

191

String getDisplayName();

192

int getIndex();

193

long getMTU();

194

String getMacaddr();

195

String[] getIPv4addr();

196

Short[] getSubnetMasks();

197

String[] getIPv6addr();

198

Short[] getPrefixLengths();

199

long getBytesRecv();

200

long getBytesSent();

201

long getPacketsRecv();

202

long getPacketsSent();

203

long getInErrors();

204

long getOutErrors();

205

long getInDrops();

206

long getCollisions();

207

long getSpeed();

208

long getTimeStamp();

209

boolean isKnownVmMacAddr();

210

IfType getIfType();

211

boolean updateAttributes();

212

213

enum IfType {

214

OTHER, REGULAR1822, HDH1822, DDN_X25, RFC877X25, ETHERNET_CSMACD,

215

ISO88023_CSMACD, ISO88024_TOKENBUS, ISO88025_TOKENRING, ISO88026_MAN,

216

STARLAN, PROTEON_10MBIT, PROTEON_80MBIT, HYPERCHANNEL, FDDI, LAPB,

217

SDLC, DS1, E1, BASIC_ISDN, PRIMARY_ISDN, PROP_PTP_SERIAL, PPP,

218

SOFTWARE_LOOPBACK, EON, ETHERNET_3MBIT, NSIP, SLIP, ULTRA, DS3, SIP,

219

FRAMERELAY, RS232, PARA, ARCNET, ARCNETPLUS, ATM, MIOX25, SONET,

220

X25PLE, ISO88022LLC, LOCALTALK, SMDSDXI, FRAMERELAYSERVICE, V35,

221

HSSI, HIPPI, MODEM, AAL5, SONETPATH, SONET_VT, SMDS_ICIP, PROP_VIRTUAL,

222

PROP_MULTIPLEXOR, IEEE80212, FIBRECHANNEL, HIPPIINTERFACE, FRAMERELAYINTERCONNECT,

223

AFLANE_8023, AFLANE_8025, CCTEMUL, FASTETHER, ISDN, V11, V36, G703_64K,

224

G703_2MB, QLLC, FASTETHERFX, CHANNEL, IEEE80211, IBM370PARCHAN,

225

ESCON, DLSW, ISDN_S, ISDN_U, LAPD, IPSWITCH, RSRB, ATM_LOGICAL,

226

DS0, DS0_BUNDLE, BSC, ASYNC, CNR, ISO88025R_DTR, EPLRS, ARAP,

227

PROP_CNLS, HOSTPAD, TERMPAD, FRAMERELAY_MPI, X213, ADSL, RADSL,

228

SDSL, VDSL, ISO88025_CRFPRINT, MYRINET, VOICE_EM, VOICE_FXO,

229

VOICE_FXS, VOICE_ENCAP, VOICE_OVERIP, ATM_DXI, ATM_FUNI, ATM_IMA,

230

PPPMULTILINKBUNDLE, IPOVERCDLC, IPOVERCLAW, STACKTOSTACK, VIRTUALIPADDRESS,

231

MPC, IPOVERATM, ISO88025_FIBER, TDLC, GIGABITETHERNET, HDLC, LAPF,

232

V37, X25MLP, X25HUNTGROUP, TRANSPHDLC, INTERLEAVE, FAST, IP,

233

DOCSCABLEMACLAYER, DOCSCABLEDOWNSTREAM, DOCSCABLEUPSTREAM, A12MPPSWITCH,

234

TUNNEL, COFFEE, CES, ATM_SUBINTERFACE, L2_VLAN, L3_IPVLAN, L3_IPXVLAN,

235

DIGITALPOWERLINE, MEDIAMAILOVERIP, DTM, DCN, IPFORWARD, MSDSL,

236

IEEE1394, IF_GSN, DVBRCC_MACLAYER, DVBRCC_DOWNSTREAM, DVBRCC_UPSTREAM,

237

ATM_VIRTUAL, MPLS_TUNNEL, SRP, VOICEOVERATM, VOICEOVERFRAMERELAY,

238

IDSL, COMPOSITELINK, SS7_SIGLINK, PROP_WIRELESS_P2P, FR_FORWARD,

239

RFC1483, USB, IEEE8023AD_LAG, BGP_POLICY_ACCOUNTING, FRF16_MFR_BUNDLE,

240

H323_GATEKEEPER, H323_PROXY, MPLS, MF_SIGLINK, HDSL2, SHDSL,

241

DS1_FDL, POS, DVB_ASI_IN, DVB_ASI_OUT, PLC, NFAS, TR008, GR303_RDT,

242

GR303_IDT, ISUP, PROP_DOCSWIRELESS_MACLAYER, PROP_DOCSWIRELESS_DOWNSTREAM,

243

PROP_DOCSWIRELESS_UPSTREAM, HIPERLAN2, PROP_BWA_P2MP, SONET_OVERHEAD_CHANNEL,

244

DIGITAL_WRAPPER_OVERHEAD_CHANNEL, AAL2, RADIO_MAC, ATM_RADIO,

245

IMT, MVL, REACH_DSL, FR_DLCI_ENDPT, ATM_VCI_ENDPT, OPTICAL_CHANNEL,

246

OPTICAL_TRANSPORT, IEEE80216_WMAN, ADSL2, MACSECCONTROLLEDIF,

247

MACSECUNCONTROLLEDIF, AVICI_OPTICAL_ETHER, ATMBOND, VOICE_FGDN,

248

VOICE_FGDS, VOICE_FGD, ISDN_Q921, ISDN_Q931, ISDN_QSIG, LAN,

249

WIRELESS_LAN, BRIDGE, LINECONFIG, WWAN, WWANPP, WWANPP2, VOICEOTHER,

250

OTHER_WWAN, UNKNOWN

251

}

252

}

253

```

254

255

## Power Sources

256

257

Battery and power supply information.

258

259

```java { .api }

260

interface PowerSource {

261

String getName();

262

String getDeviceName();

263

double getRemainingCapacityPercent();

264

double getTimeRemainingEstimated();

265

double getTimeRemainingInstant();

266

double getPowerUsageRate();

267

double getVoltage();

268

double getAmperage();

269

boolean isPowerOnLine();

270

boolean isCharging();

271

boolean isDischarging();

272

CapacityUnits getCapacityUnits();

273

int getCurrentCapacity();

274

int getMaxCapacity();

275

int getDesignCapacity();

276

int getCycleCount();

277

String getChemistry();

278

LocalDate getManufactureDate();

279

String getManufacturer();

280

String getSerialNumber();

281

double getTemperature();

282

283

enum CapacityUnits {

284

RELATIVE, MAH, MWH

285

}

286

}

287

```

288

289

## Sensors

290

291

Hardware sensor information for temperature, voltage, and fan speeds.

292

293

```java { .api }

294

interface Sensors {

295

double getCpuTemperature();

296

int[] getFanSpeeds();

297

double getCpuVoltage();

298

}

299

```

300

301

## Displays

302

303

Monitor and display information.

304

305

```java { .api }

306

interface Display {

307

byte[] getEdid();

308

}

309

```

310

311

## USB Devices

312

313

USB device information and hierarchy.

314

315

```java { .api }

316

interface UsbDevice {

317

String getName();

318

String getVendor();

319

String getVendorId();

320

String getProductId();

321

String getSerialNumber();

322

String getUniqueDeviceId();

323

List<UsbDevice> getConnectedDevices();

324

}

325

```

326

327

## Sound Cards

328

329

Audio device information.

330

331

```java { .api }

332

interface SoundCard {

333

String getDriverVersion();

334

String getName();

335

String getCodec();

336

}

337

```

338

339

## Graphics Cards

340

341

Graphics device information.

342

343

```java { .api }

344

interface GraphicsCard {

345

String getName();

346

String getDeviceId();

347

String getVendor();

348

String getVersionInfo();

349

long getVRam();

350

}

351

```

352

353

## Usage Examples

354

355

### CPU Information

356

357

```java

358

import oshi.SystemInfo;

359

import oshi.hardware.CentralProcessor;

360

361

SystemInfo si = new SystemInfo();

362

CentralProcessor cpu = si.getHardware().getProcessor();

363

364

// Basic CPU info

365

System.out.println("CPU: " + cpu.getProcessorIdentifier().getName());

366

System.out.println("Cores: " + cpu.getPhysicalProcessorCount());

367

System.out.println("Logical CPUs: " + cpu.getLogicalProcessorCount());

368

System.out.println("Max Freq: " + cpu.getMaxFreq() / 1_000_000 + " MHz");

369

370

// CPU load

371

double cpuLoad = cpu.getSystemCpuLoad(1000);

372

System.out.println("CPU Load: " + (cpuLoad * 100) + "%");

373

```

374

375

### Memory Information

376

377

```java

378

import oshi.SystemInfo;

379

import oshi.hardware.GlobalMemory;

380

381

SystemInfo si = new SystemInfo();

382

GlobalMemory memory = si.getHardware().getMemory();

383

384

long total = memory.getTotal();

385

long available = memory.getAvailable();

386

long used = total - available;

387

388

System.out.println("Total Memory: " + total / 1024 / 1024 + " MB");

389

System.out.println("Used Memory: " + used / 1024 / 1024 + " MB");

390

System.out.println("Available Memory: " + available / 1024 / 1024 + " MB");

391

```

392

393

### Disk Information

394

395

```java

396

import oshi.SystemInfo;

397

import oshi.hardware.HWDiskStore;

398

399

SystemInfo si = new SystemInfo();

400

List<HWDiskStore> disks = si.getHardware().getDiskStores();

401

402

for (HWDiskStore disk : disks) {

403

System.out.println("Disk: " + disk.getName());

404

System.out.println(" Model: " + disk.getModel());

405

System.out.println(" Size: " + disk.getSize() / 1024 / 1024 / 1024 + " GB");

406

System.out.println(" Reads: " + disk.getReads());

407

System.out.println(" Writes: " + disk.getWrites());

408

}

409

```