graphics() nvidia-smi detection improved

This commit is contained in:
Sebastian Hildebrandt 2021-01-04 07:35:58 +01:00
parent 6aa21ea907
commit e67aa92d56
23 changed files with 40 additions and 25 deletions

View File

@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 4.33.7 | 2020-01-04 | `graphics()` nvidia-smi detection improved |
| 4.33.6 | 2021-01-02 | `dockerContainerStats()` fix `tx` changed to `wx` as documented |
| 4.33.5 | 2020-12-30 | `graphics()` vram (nvidia-smi) |
| 4.33.4 | 2020-12-28 | `typescript` typings fix |

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2014-2020 Sebastian Hildebrandt
Copyright (c) 2014-2021 Sebastian Hildebrandt
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@ -851,7 +851,7 @@ All other trademarks are the property of their respective owners.
>The [`MIT`][license-url] License (MIT)
>
>Copyright © 2014-2020 Sebastian Hildebrandt, [+innovations](http://www.plus-innovations.com).
>Copyright © 2014-2021 Sebastian Hildebrandt, [+innovations](http://www.plus-innovations.com).
>
>Permission is hereby granted, free of charge, to any person obtaining a copy
>of this software and associated documentation files (the "Software"), to deal

View File

@ -83,6 +83,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.33.7</th>
<td>2020-01-04</td>
<td><span class="code">graphics()</span> nvidia-smi detection improved</td>
</tr>
<tr>
<th scope="row">4.33.6</th>
<td>2021-01-02</td>

View File

@ -169,7 +169,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.33.6</span></div>
<div class="version">Current Version: <span id="version">4.33.7</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,6 +5,11 @@
// ==================================================================================
// cli.js
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT
// ==================================================================================

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT
@ -378,11 +378,15 @@ function graphics(callback) {
if (_windows) {
try {
const basePath = util.WINDIR + '\\System32\\DriverStore\\FileRepository';
const dirContent = fs.readdirSync(basePath);
const candidateDirs = dirContent.filter(dir => dir.startsWith('nv'));
const targetDir = candidateDirs.find(dir => {
const content = fs.readdirSync([basePath, dir].join('/'));
return content.includes('nvidia-smi.exe');
// find all directories that have an nvidia-smi.exe file
const candidateDirs = fs.readdirSync(basePath).filter(dir => {
return fs.readdirSync([basePath, dir].join('/')).includes('nvidia-smi.exe');
});
// use the directory with the most recently created nvidia-smi.exe file
const targetDir = candidateDirs.reduce((prevDir, currentDir) => {
const previousNvidiaSmi = fs.statSync([basePath, prevDir, 'nvidia-smi.exe'].join('/'));
const currentNvidiaSmi = fs.statSync([basePath, currentDir, 'nvidia-smi.exe'].join('/'));
return (previousNvidiaSmi.ctimeMs > currentNvidiaSmi.ctimeMs) ? prevDir : currentDir;
});
if (targetDir) {

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// Contributors: Guillaume Legrain (https://github.com/glegrain)

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT

View File

@ -5,7 +5,7 @@
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 2020
// Copyright: (c) 2014 - 2021
// Author: Sebastian Hildebrandt
// ----------------------------------------------------------------------------------
// License: MIT