Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
358 views
in Technique[技术] by (71.8m points)

javascript - Get CPU/GPU/memory information

I need to get any information about the CPU/GPU/memory.The number of cores, memory value, memory and cpu usage... I found a way to do this for IE:How to Use JavaScript to Find Hardware Information

solutions for other browsers I do not know. Any idea how to do it? maybe webgl has access to information about your computer? or flash? or any other technology?

Thank you very much

question from:https://stackoverflow.com/questions/15464896/get-cpu-gpu-memory-information

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This code will print GPU infos an will list all info you can have with the performance object of this browser (there is no standard for the BOM so it changes for each browser).

<html>

<body>
  <canvas id="glcanvas" width="0" height="0"></canvas>
  <script>
    var performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {};

    document.write("<br>");
    for (var value in performance) {
      document.write(value + "<br>");
    }

    document.write("<br><br><br>");

    var canvas;
    canvas = document.getElementById("glcanvas");
    var gl = canvas.getContext("experimental-webgl");

    document.write(gl.getParameter(gl.RENDERER) + "<br>");
    document.write(gl.getParameter(gl.VENDOR) + "<br>");
    document.write(getUnmaskedInfo(gl).vendor + "<br>");
    document.write(getUnmaskedInfo(gl).renderer + "<br>");


    function getUnmaskedInfo(gl) {
      var unMaskedInfo = {
        renderer: '',
        vendor: ''
      };

      var dbgRenderInfo = gl.getExtension("WEBGL_debug_renderer_info");
      if (dbgRenderInfo != null) {
        unMaskedInfo.renderer = gl.getParameter(dbgRenderInfo.UNMASKED_RENDERER_WEBGL);
        unMaskedInfo.vendor = gl.getParameter(dbgRenderInfo.UNMASKED_VENDOR_WEBGL);
      }

      return unMaskedInfo;
    }
  </script>
</body>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...