Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package s-tui for openSUSE:Factory checked 
in at 2021-08-19 10:01:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/s-tui (Old)
 and      /work/SRC/openSUSE:Factory/.s-tui.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "s-tui"

Thu Aug 19 10:01:00 2021 rev:7 rq:912772 version:1.1.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/s-tui/s-tui.changes      2021-03-03 
18:36:08.147425394 +0100
+++ /work/SRC/openSUSE:Factory/.s-tui.new.1899/s-tui.changes    2021-08-19 
10:02:02.055189880 +0200
@@ -1,0 +2,7 @@
+Tue Aug 17 16:02:45 UTC 2021 - Martin Hauke <[email protected]>
+
+- Update to version 1.1.3
+  * s-tui now supports power reads on AMD CPUs.
+  * Fixed crashing bug on Raspberry pi.
+
+-------------------------------------------------------------------

Old:
----
  s-tui-1.1.1.tar.gz

New:
----
  s-tui-1.1.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ s-tui.spec ++++++
--- /var/tmp/diff_new_pack.otHv1A/_old  2021-08-19 10:02:02.479189365 +0200
+++ /var/tmp/diff_new_pack.otHv1A/_new  2021-08-19 10:02:02.483189360 +0200
@@ -18,7 +18,7 @@
 
 
 Name:           s-tui
-Version:        1.1.1
+Version:        1.1.3
 Release:        0
 Summary:        Terminal based CPU stress and monitoring utility
 License:        GPL-2.0-or-later

++++++ s-tui-1.1.1.tar.gz -> s-tui-1.1.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/s-tui-1.1.1/.github/workflows/pythonpackage.yml 
new/s-tui-1.1.3/.github/workflows/pythonpackage.yml
--- old/s-tui-1.1.1/.github/workflows/pythonpackage.yml 2021-02-27 
11:15:49.000000000 +0100
+++ new/s-tui-1.1.3/.github/workflows/pythonpackage.yml 2021-07-24 
16:11:58.000000000 +0200
@@ -9,7 +9,7 @@
     strategy:
       max-parallel: 4
       matrix:
-        python-version: [2.7, 3.5, 3.6, 3.7]
+        python-version: [3.6, 3.7, 3.8]
 
     steps:
     - uses: actions/checkout@v1
@@ -32,3 +32,4 @@
       run: |
         pip install pytest
         pytest
+        python -m s_tui.s_tui -j
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/s-tui-1.1.1/.travis.yml new/s-tui-1.1.3/.travis.yml
--- old/s-tui-1.1.1/.travis.yml 2021-02-27 11:15:49.000000000 +0100
+++ new/s-tui-1.1.3/.travis.yml 1970-01-01 01:00:00.000000000 +0100
@@ -1,23 +0,0 @@
-language: python
-matrix:
-    include:
-        # Linux
-        - python: 2.7
-        - python: 3.4
-        - python: 3.5
-        - python: 3.6
-        - python: 3.7
-          dist: xenial
-
-install:
-  - "pip install flake8"
-  - "python setup.py install"
-
-before_script:
-  - "flake8 s_tui"
-
-script:
-  - "python -m s_tui.tests.test_util_source"
-  - "s-tui -t"
-  - "s-tui -j"
-  - "s-tui -dr"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/s-tui-1.1.1/README.md new/s-tui-1.1.3/README.md
--- old/s-tui-1.1.1/README.md   2021-02-27 11:15:49.000000000 +0100
+++ new/s-tui-1.1.3/README.md   2021-07-24 16:11:58.000000000 +0200
@@ -1,6 +1,5 @@
 # The Stress Terminal UI: s-tui
 
-[![Build 
Status](https://travis-ci.org/amanusk/s-tui.svg?branch=master)](https://travis-ci.org/amanusk/s-tui)
 [![PyPI 
version](https://badge.fury.io/py/s-tui.svg)](https://badge.fury.io/py/s-tui)
 
[![Downloads](https://pepy.tech/badge/s-tui/month)](https://pepy.tech/project/s-tui)
 
@@ -25,6 +24,7 @@
     - [Ubuntu (18.04, 16.04)](#ubuntu-1804-1604)
     - [Arch Linux, Manjaro](#arch-linux-manjaro)
     - [OpenSUSE](#opensuse)
+    - [Fedora](#fedora)
   - [Options](#options)
   - [Dependencies](#dependencies)
   - [Configuration](#configuration)
@@ -115,6 +115,14 @@
 sudo zypper install s-tui
 ```
 
+### Fedora
+
+`s-tui` is in the Fedora 
[repository](https://src.fedoraproject.org/rpms/s-tui):
+
+```
+sudo dnf install s-tui
+```
+
 ## Options
 
 ```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/s-tui-1.1.1/s_tui/helper_functions.py 
new/s-tui-1.1.3/s_tui/helper_functions.py
--- old/s-tui-1.1.1/s_tui/helper_functions.py   2021-02-27 11:15:49.000000000 
+0100
+++ new/s-tui-1.1.3/s_tui/helper_functions.py   2021-07-24 16:11:58.000000000 
+0200
@@ -30,7 +30,7 @@
 
 from collections import OrderedDict
 
-__version__ = "1.1.1"
+__version__ = "1.1.3"
 
 _DEFAULT = object()
 PY3 = sys.version_info[0] == 3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/s-tui-1.1.1/s_tui/sources/rapl_read.py 
new/s-tui-1.1.3/s_tui/sources/rapl_read.py
--- old/s-tui-1.1.1/s_tui/sources/rapl_read.py  2021-02-27 11:15:49.000000000 
+0100
+++ new/s-tui-1.1.3/s_tui/sources/rapl_read.py  2021-07-24 16:11:58.000000000 
+0200
@@ -24,6 +24,8 @@
 import os
 import re
 from collections import namedtuple
+from multiprocessing import cpu_count
+from sys import byteorder
 from s_tui.helper_functions import cat
 
 
@@ -31,6 +33,13 @@
 AMD_ENERGY_DIR_GLOB = '/sys/devices/platform/amd_energy.0/hwmon/hwmon*/'
 MICRO_JOULE_IN_JOULE = 1000000.0
 
+
+UNIT_MSR = 0xC0010299
+CORE_MSR = 0xC001029A
+PACKAGE_MSR = 0xC001029B
+ENERGY_UNIT_MASK = 0x1F00
+
+
 RaplStats = namedtuple('rapl', ['label', 'current', 'max'])
 
 
@@ -104,8 +113,91 @@
         return os.path.exists("/sys/devices/platform/amd_energy.0")
 
 
+class AMDRaplMsrReader:
+    def __init__(self):
+        self.core_msr_files = {}
+        self.package_msr_files = {}
+        for i in range(cpu_count()):
+            curr_core_id = int(cat("/sys/devices/system/cpu/cpu" + str(i) +
+                                   "/topology/core_id", binary=False))
+            if curr_core_id not in self.core_msr_files:
+                self.core_msr_files[curr_core_id] = "/dev/cpu/" + \
+                                                    str(i) + "/msr"
+
+            curr_package_id = int(cat("/sys/devices/system/cpu/cpu" + str(i) +
+                                      "/topology/physical_package_id",
+                                      binary=False))
+            if curr_package_id not in self.package_msr_files:
+                self.package_msr_files[curr_package_id] = "/dev/cpu/" + \
+                                                          str(i) + "/msr"
+
+    @staticmethod
+    def read_msr(filename, register):
+        f = open(filename, "rb")
+        f.seek(register)
+        res = int.from_bytes(f.read(8), byteorder)
+        f.close()
+        return res
+
+    def read_power(self):
+        ret = []
+        for i, filename in self.package_msr_files.items():
+            unit_msr = self.read_msr(filename, UNIT_MSR)
+            energy_factor = 0.5 ** ((unit_msr & ENERGY_UNIT_MASK) >> 8)
+            package_msr = self.read_msr(filename, PACKAGE_MSR)
+            ret.append(RaplStats("Package " + str(i + 1), package_msr *
+                                 energy_factor * MICRO_JOULE_IN_JOULE, 0.0))
+
+        for i, filename in self.core_msr_files.items():
+            unit_msr = self.read_msr(filename, UNIT_MSR)
+            energy_factor = 0.5 ** ((unit_msr & ENERGY_UNIT_MASK) >> 8)
+            core_msr = self.read_msr(filename, CORE_MSR)
+            ret.append(RaplStats("Core " + str(i + 1), core_msr * energy_factor
+                                 * MICRO_JOULE_IN_JOULE, 0.0))
+
+        return ret
+
+    @staticmethod
+    def available():
+        cpuinfo = cat("/proc/cpuinfo", binary=False)
+        # The reader only supports family 17h CPUs
+        m = re.search(r"vendor_id[\s]+: ([A-Za-z]+)", cpuinfo)
+
+        if not m or m is None:
+            return False
+
+        if m.group(1) != "AuthenticAMD":
+            return False
+
+        m = re.search(r"cpu family[\s]+: ([0-9]+)", cpuinfo)
+        if int(m[1]) != 0x17:
+            return False
+
+        # with open("/proc/cpuinfo", "rb") as cpuinfo:
+        #     all_info = cpuinfo.readlines()
+        #     for line in all_info:
+        #         if b"vendor_id" in line:
+        #             print("Verndor id", line)
+        #             if b"AuthenticAMD" not in line:
+        #                 return False
+
+        #     for line in all_info:
+        #         if b"cpu family" in line:
+        #             print("cpu family", line)
+        #             m = re.search("cpu family[\s]+: ([0-9]+)", cpuinfo)
+        #             if int(m[1]) != 0x17:
+        #                 return False
+
+        # Check whether MSRs are available and we have permission to read them
+        try:
+            open("/dev/cpu/0/msr")
+            return True
+        except (FileNotFoundError, PermissionError):
+            return False
+
+
 def get_power_reader():
-    for ReaderType in (RaplReader, AMDEnergyReader):
+    for ReaderType in (RaplReader, AMDEnergyReader, AMDRaplMsrReader):
         if ReaderType.available():
             return ReaderType()
     return None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/s-tui-1.1.1/setup.cfg new/s-tui-1.1.3/setup.cfg
--- old/s-tui-1.1.1/setup.cfg   2021-02-27 11:15:49.000000000 +0100
+++ new/s-tui-1.1.3/setup.cfg   2021-07-24 16:11:58.000000000 +0200
@@ -1,2 +1,3 @@
 [metadata]
 description-file = README.md
+license_files = LICENSE

Reply via email to