Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package btop for openSUSE:Factory checked in 
at 2021-12-30 17:10:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/btop (Old)
 and      /work/SRC/openSUSE:Factory/.btop.new.1896 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "btop"

Thu Dec 30 17:10:29 2021 rev:11 rq:943242 version:1.1.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/btop/btop.changes        2021-12-13 
20:51:18.960670220 +0100
+++ /work/SRC/openSUSE:Factory/.btop.new.1896/btop.changes      2021-12-30 
17:10:31.282856026 +0100
@@ -1,0 +2,9 @@
+Wed Dec 29 21:39:39 UTC 2021 - Scott Bradnick <scott.bradn...@suse.com> - 1.1.4
+
+- Update to upstream release 1.1.4:
+       * Fixed: Create dependency files in build directory when compiling, by 
@stwnt
+       * Fixed: fix CPU temp fallback on macOS, by @joske
+       * Changed: From rng::sort() to rng::stable_sort() for more stability
+       * Fixed: in_avail() can always be zero, by @pg83
+
+-------------------------------------------------------------------

Old:
----
  v1.1.3.tar.gz

New:
----
  v1.1.4.tar.gz

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

Other differences:
------------------
++++++ btop.spec ++++++
--- /var/tmp/diff_new_pack.dLt4cu/_old  2021-12-30 17:10:31.770856297 +0100
+++ /var/tmp/diff_new_pack.dLt4cu/_new  2021-12-30 17:10:31.774856300 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           btop
-Version:        1.1.3
+Version:        1.1.4
 Release:        0
 Summary:        Usage and stats for processor, memory, disks, network and 
processes
 License:        Apache-2.0

++++++ v1.1.3.tar.gz -> v1.1.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/CHANGELOG.md new/btop-1.1.4/CHANGELOG.md
--- old/btop-1.1.3/CHANGELOG.md 2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/CHANGELOG.md 2021-12-29 14:40:32.000000000 +0100
@@ -1,3 +1,13 @@
+## v1.1.4
+
+* Fixed: Create dependency files in build directory when compiling, by @stwnt
+
+* Fixed: fix CPU temp fallback on macOS, by @joske
+
+* Changed: From rng::sort() to rng::stable_sort() for more stability
+
+* Fixed: in_avail() can always be zero, by @pg83
+
 ## v1.1.3
 
 * Added: New theme ayu, by @AlphaNecron
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/Makefile new/btop-1.1.4/Makefile
--- old/btop-1.1.3/Makefile     2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/Makefile     2021-12-29 14:40:32.000000000 +0100
@@ -223,12 +223,7 @@
        @sleep 0.3 2>/dev/null || true
        @TSTAMP=$$(date +%s 2>/dev/null || echo "0")
        @$(QUIET) || printf "\033[1;97mCompiling $<\033[0m\n"
-       @$(CXX) $(CXXFLAGS) $(INC) -c -o $@ $< || exit 1
-       @$(CXX) $(CXXFLAGS) $(INC) -MM $(SRCDIR)/$*.$(SRCEXT) > 
$(BUILDDIR)/$*.$(DEPEXT) >/dev/null || exit 1
-       @cp -f $(BUILDDIR)/$*.$(DEPEXT) $(BUILDDIR)/$*.$(DEPEXT).tmp
-       @sed -e 's|.*:|$(BUILDDIR)/$*.$(OBJEXT):|' < 
$(BUILDDIR)/$*.$(DEPEXT).tmp > $(BUILDDIR)/$*.$(DEPEXT)
-       @sed -e 's/.*://' -e 's/\\$$//' < $(BUILDDIR)/$*.$(DEPEXT).tmp | fmt -1 
| sed -e 's/^ *//' -e 's/$$/:/' >> $(BUILDDIR)/$*.$(DEPEXT)
-       @rm -f $(BUILDDIR)/$*.$(DEPEXT).tmp
+       @$(CXX) $(CXXFLAGS) $(INC) -MMD -c -o $@ $< || exit 1
        @printf "\033[1;92m-> \033[1;37m$@ 
\033[100D\033[35C\033[1;93m(\033[1;97m$$(du -ah $@ | cut -f1)iB\033[1;93m) 
\033[92m(\033[97m$$($(DATE_CMD) -d @$$(expr $$(date +%s 2>/dev/null || echo 
"0") - $${TSTAMP} 2>/dev/null) -u +%Mm:%Ss 2>/dev/null | sed 's/^00m://' || 
echo '')\033[92m)\033[0m\n"
 
 #? Non-File Targets
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/README.md new/btop-1.1.4/README.md
--- old/btop-1.1.3/README.md    2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/README.md    2021-12-29 14:40:32.000000000 +0100
@@ -507,8 +507,8 @@
 force_tty = False
 
 #* Define presets for the layout of the boxes. Preset 0 is always all boxes 
shown with default settings. Max 9 presets.
-#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positons, 
G=graph symbol to use for box.
-#* Use withespace " " as seprator between different presets.
+#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, 
G=graph symbol to use for box.
+#* Use withespace " " as separator between different presets.
 #* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty"
 presets = "cpu:1:default,proc:0:default 
cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/btop.cpp new/btop-1.1.4/src/btop.cpp
--- old/btop-1.1.3/src/btop.cpp 2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/src/btop.cpp 2021-12-29 14:40:32.000000000 +0100
@@ -17,6 +17,7 @@
 */
 
 #include <csignal>
+#include <clocale>
 #include <pthread.h>
 #include <thread>
 #include <numeric>
@@ -56,7 +57,7 @@
                {"#801414", "????????????????????????   ?????????   
????????????????????????????????????        ?????????    ?????????"},
                {"#000000", "?????????????????????    ?????????    
????????????????????? ?????????"},
        };
-       const string Version = "1.1.3";
+       const string Version = "1.1.4";
 
        int coreCount;
        string overlay;
@@ -237,14 +238,14 @@
        }
        Logger::info("Quitting! Runtime: " + sec_to_dhms(time_s() - 
Global::start_time));
 
+       const auto excode = (sig != -1 ? sig : 0);
+
        //? Assume error if still not cleaned up and call quick_exit to avoid a 
segfault from Tools::atomic_lock destructor
-#ifndef __APPLE__
-       if (Tools::active_locks > 0) {
-               quick_exit((sig != -1 ? sig : 0));
-       }
+#ifdef __APPLE__
+       _Exit(excode);
+#else
+       quick_exit(excode);
 #endif
-
-       if (sig != -1) exit(sig);
 }
 
 //* Handler for SIGTSTP; stops threads, restores terminal and sends SIGSTOP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/btop_config.cpp 
new/btop-1.1.4/src/btop_config.cpp
--- old/btop-1.1.3/src/btop_config.cpp  2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/src/btop_config.cpp  2021-12-29 14:40:32.000000000 +0100
@@ -50,8 +50,8 @@
                                                                "#* Will force 
16-color mode and TTY theme, set all graph symbols to \"tty\" and swap out 
other non tty friendly symbols."},
 
                {"presets",                             "#* Define presets for 
the layout of the boxes. Preset 0 is always all boxes shown with default 
settings. Max 9 presets.\n"
-                                                               "#* Format: 
\"box_name:P:G,box_name:P:G\" P=(0 or 1) for alternate positons, G=graph symbol 
to use for box.\n"
-                                                               "#* Use 
withespace \" \" as seprator between different presets.\n"
+                                                               "#* Format: 
\"box_name:P:G,box_name:P:G\" P=(0 or 1) for alternate positions, G=graph 
symbol to use for box.\n"
+                                                               "#* Use 
withespace \" \" as separator between different presets.\n"
                                                                "#* Example: 
\"cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty\""},
 
                {"vim_keys",                    "#* Set to True to enable 
\"h,j,k,l\" keys for directional control in lists.\n"
@@ -603,4 +603,4 @@
                        }
                }
        }
-}
\ No newline at end of file
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/btop_config.hpp 
new/btop-1.1.4/src/btop_config.hpp
--- old/btop-1.1.3/src/btop_config.hpp  2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/src/btop_config.hpp  2021-12-29 14:40:32.000000000 +0100
@@ -48,7 +48,7 @@
        extern vector<string> available_batteries;
        extern int current_preset;
 
-       //* Check if string only contains space seperated valid names for boxes
+       //* Check if string only contains space separated valid names for boxes
        bool check_boxes(const string& boxes);
 
        //* Toggle box and update config string shown_boxes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/btop_input.cpp 
new/btop-1.1.4/src/btop_input.cpp
--- old/btop-1.1.3/src/btop_input.cpp   2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/src/btop_input.cpp   2021-12-29 14:40:32.000000000 +0100
@@ -19,6 +19,8 @@
 #include <iostream>
 #include <ranges>
 #include <vector>
+#include <thread>
+#include <mutex>
 
 #include <btop_input.hpp>
 #include <btop_tools.hpp>
@@ -78,14 +80,66 @@
        deque<string> history(50, "");
        string old_filter;
 
+       struct InputThr {
+               InputThr() : thr(run, this) {
+               }
+
+               static void run(InputThr* that) {
+                       that->runImpl();
+               }
+
+               void runImpl() {
+                       char ch = 0;
+
+                       // TODO(pg83): read whole buffer
+                       while (cin.get(ch)) {
+                               std::lock_guard<std::mutex> g(lock);
+                               current.push_back(ch);
+                               if (current.size() > 100) {
+                                       current.clear();
+                               }
+                       }
+               }
+
+               size_t avail() {
+                       std::lock_guard<std::mutex> g(lock);
+
+                       return current.size();
+               }
+
+               std::string get() {
+                       std::string res;
+
+                       {
+                               std::lock_guard<std::mutex> g(lock);
+
+                               res.swap(current);
+                       }
+
+                       return res;
+               }
+
+               static InputThr& instance() {
+                       // intentional memory leak, to simplify shutdown process
+                       static InputThr* input = new InputThr();
+
+                       return *input;
+               }
+
+               std::string current;
+               // TODO(pg83): use std::conditional_variable instead of sleep
+               std::mutex lock;
+               std::thread thr;
+       };
+
        bool poll(int timeout) {
-               if (timeout < 1) return cin.rdbuf()->in_avail() > 0;
+               if (timeout < 1) return InputThr::instance().avail() > 0;
                while (timeout > 0) {
                        if (interrupt) {
                                interrupt = false;
                                return false;
                        }
-                       if (cin.rdbuf()->in_avail() > 0) return true;
+                       if (InputThr::instance().avail() > 0) return true;
                        sleep_ms(timeout < 10 ? timeout : 10);
                        timeout -= 10;
                }
@@ -93,9 +147,7 @@
        }
 
        string get() {
-               string key;
-               while (cin.rdbuf()->in_avail() > 0 and key.size() < 100) key += 
cin.get();
-               if (cin.rdbuf()->in_avail() > 0) clear();
+               string key = InputThr::instance().get();
                if (not key.empty()) {
                        //? Remove escape code prefix if present
                        if (key.substr(0, 2) == Fx::e) {
@@ -168,19 +220,14 @@
        }
 
        string wait() {
-               while (cin.rdbuf()->in_avail() < 1) {
+               while (InputThr::instance().avail() < 1) {
                        sleep_ms(10);
                }
                return get();
        }
 
        void clear() {
-               if (auto first_num = cin.rdbuf()->in_avail(); first_num > 0) {
-                       while (cin.rdbuf()->in_avail() == first_num) {
-                               if (first_num-- <= 0) break;
-                               cin.ignore(1);
-                       }
-               }
+               // do not need it, actually
        }
 
        void process(const string& key) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/btop_menu.cpp 
new/btop-1.1.4/src/btop_menu.cpp
--- old/btop-1.1.3/src/btop_menu.cpp    2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/src/btop_menu.cpp    2021-12-29 14:40:32.000000000 +0100
@@ -194,10 +194,10 @@
                                "Max 9 presets.",
                                "",
                                "Format: \"box_name:P:G,box_name:P:G\"",
-                               "P=(0 or 1) for alternate positons.",
+                               "P=(0 or 1) for alternate positions.",
                                "G=graph symbol to use for box.",
                                "",
-                               "Use withespace \" \" as seprator between",
+                               "Use withespace \" \" as separator between",
                                "different presets.",
                                "",
                                "Example:",
@@ -206,7 +206,7 @@
                                "Manually set which boxes to show.",
                                "",
                                "Available values are \"cpu mem net proc\".",
-                               "Seperate values with whitespace.",
+                               "Separate values with whitespace.",
                                "",
                                "Toggle between presets with key \"p\"."},
                        {"update_ms",
@@ -435,7 +435,7 @@
                                "equals 100 percent in the io graphs.",
                                "(100 MiB/s by default).",
                                "",
-                               "Format: \"device:speed\" seperate disks with",
+                               "Format: \"device:speed\" separate disks with",
                                "whitespace \" \".",
                                "",
                                "Example: \"/dev/sda:100, /dev/sdb:20\"."},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/linux/btop_collect.cpp 
new/btop-1.1.4/src/linux/btop_collect.cpp
--- old/btop-1.1.3/src/linux/btop_collect.cpp   2021-12-11 18:22:08.000000000 
+0100
+++ new/btop-1.1.4/src/linux/btop_collect.cpp   2021-12-29 14:40:32.000000000 
+0100
@@ -1631,17 +1631,29 @@
 
                //* Sort processes
                if (sorted_change or not no_update) {
-                       switch (v_index(sort_vector, sorting)) {
-                                       case 0: rng::sort(current_procs, 
rng::greater{}, &proc_info::pid);              break;
-                                       case 1: rng::sort(current_procs, 
rng::greater{}, &proc_info::name);             break;
-                                       case 2: rng::sort(current_procs, 
rng::greater{}, &proc_info::cmd);              break;
-                                       case 3: rng::sort(current_procs, 
rng::greater{}, &proc_info::threads);  break;
-                                       case 4: rng::sort(current_procs, 
rng::greater{}, &proc_info::user);     break;
-                                       case 5: rng::sort(current_procs, 
rng::greater{}, &proc_info::mem);              break;
-                                       case 6: rng::sort(current_procs, 
rng::greater{}, &proc_info::cpu_p);    break;
-                                       case 7: rng::sort(current_procs, 
rng::greater{}, &proc_info::cpu_c);    break;
+                       if (reverse) {
+                               switch (v_index(sort_vector, sorting)) {
+                                       case 0: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::pid);          break;
+                                       case 1: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::name);         break;
+                                       case 2: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::cmd);          break;
+                                       case 3: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::threads);      break;
+                                       case 4: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::user);         break;
+                                       case 5: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::mem);          break;
+                                       case 6: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::cpu_p);        break;
+                                       case 7: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::cpu_c);        break;
+                               }
+                       } else {
+                               switch (v_index(sort_vector, sorting)) {
+                                               case 0: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::pid);               
break;
+                                               case 1: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::name);              
break;
+                                               case 2: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::cmd);               
break;
+                                               case 3: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::threads);   break;
+                                               case 4: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::user);      break;
+                                               case 5: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::mem);               
break;
+                                               case 6: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::cpu_p);     break;
+                                               case 7: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::cpu_c);     break;
+                               }
                        }
-                       if (reverse) rng::reverse(current_procs);
 
                        //* When sorting with "cpu lazy" push processes over 
threshold cpu usage to the front regardless of cumulative usage
                        if (not tree and not reverse and sorting == "cpu lazy") 
{
@@ -1714,9 +1726,7 @@
                        }
 
                        //? Final sort based on tree index
-                       rng::sort(current_procs, rng::less{}, 
&proc_info::tree_index);
-                       if (reverse) rng::reverse(current_procs);
-
+                       rng::stable_sort(current_procs, rng::less{}, 
&proc_info::tree_index);
                }
 
                numpids = (int)current_procs.size() - filter_found;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/osx/btop_collect.cpp 
new/btop-1.1.4/src/osx/btop_collect.cpp
--- old/btop-1.1.3/src/osx/btop_collect.cpp     2021-12-11 18:22:08.000000000 
+0100
+++ new/btop-1.1.4/src/osx/btop_collect.cpp     2021-12-29 14:40:32.000000000 
+0100
@@ -15,6 +15,7 @@
 indent = tab
 tab-size = 4
 */
+
 #include <CoreFoundation/CoreFoundation.h>
 #include <IOKit/IOKitLib.h>
 #include <arpa/inet.h>
@@ -68,6 +69,7 @@
        cpu_info current_cpu;
        fs::path freq_path = 
"/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq";
        bool got_sensors = false, cpu_temp_only = false;
+       int core_offset = 0;
 
        //* Populate found_sensors map
        bool get_sensors();
@@ -241,21 +243,34 @@
        }
 
        bool get_sensors() {
+               Logger::debug("get_sensors(): show_coretemp=" + 
std::to_string(Config::getB("show_coretemp")) + " check_temp=" + 
std::to_string(Config::getB("check_temp")));
                got_sensors = false;
                if (Config::getB("show_coretemp") and 
Config::getB("check_temp")) {
                        ThermalSensors sensors;
                        if (sensors.getSensors() > 0) {
+                               Logger::debug("M1 sensors found");
                                got_sensors = true;
                                cpu_temp_only = true;
                                macM1 = true;
                        } else {
                                // try SMC (intel)
+                               Logger::debug("checking intel");
                                SMCConnection smcCon;
                                try {
                                        long long t = smcCon.getTemp(-1);  // 
check if we have package T
                                        if (t > -1) {
+                                               Logger::debug("intel sensors 
found");
                                                got_sensors = true;
+                                               t = smcCon.getTemp(0);
+                                               if (t == -1) {
+                                                       // for some macs the 
core offset is 1 - check if we get a sane value with 1
+                                                       if (smcCon.getTemp(1) > 
-1) {
+                                                               
Logger::debug("intel sensors with offset 1");
+                                                               core_offset = 1;
+                                                       }
+                                               }
                                        } else {
+                                               Logger::debug("no intel sensors 
found");
                                                got_sensors = false;
                                        }
                                } catch (std::runtime_error &e) {
@@ -282,14 +297,12 @@
                                long long packageT = smcCon.getTemp(-1); // -1 
returns package T
                                current_cpu.temp.at(0).push_back(packageT);
 
-                               if (Config::getB("show_coretemp") and not 
cpu_temp_only) {
-                                       for (int core = 0; core < 
Shared::coreCount; core++) {
-                                               long long temp = 
smcCon.getTemp(core / threadsPerCore); // same temp for all threads of same 
physical core
-                                               if (cmp_less(core + 1, 
current_cpu.temp.size())) {
-                                                       
current_cpu.temp.at(core + 1).push_back(temp);
-                                                       if 
(current_cpu.temp.at(core + 1).size() > 20)
-                                                               
current_cpu.temp.at(core + 1).pop_front();
-                                               }
+                               for (int core = 0; core < Shared::coreCount; 
core++) {
+                                       long long temp = smcCon.getTemp((core / 
threadsPerCore) + core_offset); // same temp for all threads of same physical 
core
+                                       if (cmp_less(core + 1, 
current_cpu.temp.size())) {
+                                               current_cpu.temp.at(core + 
1).push_back(temp);
+                                               if (current_cpu.temp.at(core + 
1).size() > 20)
+                                                       
current_cpu.temp.at(core + 1).pop_front();
                                        }
                                }
                        }
@@ -1306,17 +1319,29 @@
 
                //* Sort processes
                if (sorted_change or not no_update) {
-                       switch (v_index(sort_vector, sorting)) {
-                                       case 0: rng::sort(current_procs, 
rng::greater{}, &proc_info::pid);              break;
-                                       case 1: rng::sort(current_procs, 
rng::greater{}, &proc_info::name);             break;
-                                       case 2: rng::sort(current_procs, 
rng::greater{}, &proc_info::cmd);              break;
-                                       case 3: rng::sort(current_procs, 
rng::greater{}, &proc_info::threads);  break;
-                                       case 4: rng::sort(current_procs, 
rng::greater{}, &proc_info::user);     break;
-                                       case 5: rng::sort(current_procs, 
rng::greater{}, &proc_info::mem);              break;
-                                       case 6: rng::sort(current_procs, 
rng::greater{}, &proc_info::cpu_p);    break;
-                                       case 7: rng::sort(current_procs, 
rng::greater{}, &proc_info::cpu_c);    break;
+                       if (reverse) {
+                               switch (v_index(sort_vector, sorting)) {
+                                       case 0: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::pid);          break;
+                                       case 1: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::name);         break;
+                                       case 2: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::cmd);          break;
+                                       case 3: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::threads);      break;
+                                       case 4: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::user);         break;
+                                       case 5: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::mem);          break;
+                                       case 6: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::cpu_p);        break;
+                                       case 7: rng::stable_sort(current_procs, 
rng::less{}, &proc_info::cpu_c);        break;
+                               }
+                       } else {
+                               switch (v_index(sort_vector, sorting)) {
+                                               case 0: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::pid);               
break;
+                                               case 1: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::name);              
break;
+                                               case 2: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::cmd);               
break;
+                                               case 3: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::threads);   break;
+                                               case 4: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::user);              
break;
+                                               case 5: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::mem);               
break;
+                                               case 6: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::cpu_p);     break;
+                                               case 7: 
rng::stable_sort(current_procs, rng::greater{}, &proc_info::cpu_c);     break;
+                               }
                        }
-                       if (reverse) rng::reverse(current_procs);
 
                        //* When sorting with "cpu lazy" push processes over 
threshold cpu usage to the front regardless of cumulative usage
                        if (not tree and not reverse and sorting == "cpu lazy") 
{
@@ -1382,8 +1407,7 @@
                        }
 
                        //? Final sort based on tree index
-                       rng::sort(current_procs, rng::less{}, 
&proc_info::tree_index);
-                       if (reverse) rng::reverse(current_procs);
+                       rng::stable_sort(current_procs, rng::less{}, 
&proc_info::tree_index);
                }
 
                numpids = (int)current_procs.size() - filter_found;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/osx/sensors.cpp 
new/btop-1.1.4/src/osx/sensors.cpp
--- old/btop-1.1.3/src/osx/sensors.cpp  2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/src/osx/sensors.cpp  2021-12-29 14:40:32.000000000 +0100
@@ -1,3 +1,21 @@
+/* Copyright 2021 Aristocratos (ja...@qvantnet.com)
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+indent = tab
+tab-size = 4
+*/
+
 #include "sensors.hpp"
 
 #include <CoreFoundation/CoreFoundation.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/osx/sensors.hpp 
new/btop-1.1.4/src/osx/sensors.hpp
--- old/btop-1.1.3/src/osx/sensors.hpp  2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/src/osx/sensors.hpp  2021-12-29 14:40:32.000000000 +0100
@@ -1,3 +1,20 @@
+/* Copyright 2021 Aristocratos (ja...@qvantnet.com)
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+indent = tab
+tab-size = 4
+*/
 
 namespace Cpu {
        class ThermalSensors {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/osx/smc.cpp 
new/btop-1.1.4/src/osx/smc.cpp
--- old/btop-1.1.3/src/osx/smc.cpp      2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/src/osx/smc.cpp      2021-12-29 14:40:32.000000000 +0100
@@ -1,3 +1,21 @@
+/* Copyright 2021 Aristocratos (ja...@qvantnet.com)
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+indent = tab
+tab-size = 4
+*/
+
 #include "smc.hpp"
 
 static UInt32 _strtoul(char *str, int size, int base) {
@@ -50,32 +68,39 @@
         IOServiceClose(conn);
        }
 
+       long long SMCConnection::getSMCTemp(char *key) {
+               SMCVal_t val;
+               kern_return_t result;
+               result = SMCReadKey(key, &val);
+               if (result == kIOReturnSuccess) {
+                       if (val.dataSize > 0) {
+                               if (strcmp(val.dataType, DATATYPE_SP78) == 0) {
+                                       // convert sp78 value to temperature
+                                       int intValue = val.bytes[0] * 256 + 
(unsigned char)val.bytes[1];
+                                       return static_cast<long long>(intValue 
/ 256.0);
+                               }
+                       }
+               }
+               return -1;
+       }
+
        // core means physical core in SMC, while in core map it's cpu threads 
:-/ Only an issue on hackintosh?
        // this means we can only get the T per physical core
        // another issue with the SMC API is that the key is always 4 chars -> 
what with systems with more than 9 physical cores?
        // no Mac models with more than 18 threads are released, so no problem 
so far
        // according to VirtualSMC docs (hackintosh fake SMC) the enumeration 
follows with alphabetic chars - not implemented yet here (nor in VirtualSMC)
        long long SMCConnection::getTemp(int core) {
-               SMCVal_t val;
-               kern_return_t result;
                char key[] = SMC_KEY_CPU_TEMP;
                if (core >= 0) {
                        snprintf(key, 5, "TC%1dc", core);
                }
-               result = SMCReadKey(key, &val);
-               if (result != kIOReturnSuccess) {
+               long long result = getSMCTemp(key);
+               if (result == -1) {
                        // try again with C
                        snprintf(key, 5, "TC%1dC", core);
-                       result = SMCReadKey(key, &val);
+                       result = getSMCTemp(key);
                }
-               if (result == kIOReturnSuccess) {
-                       if (strcmp(val.dataType, DATATYPE_SP78) == 0) {
-                               // convert sp78 value to temperature
-                               int intValue = val.bytes[0] * 256 + (unsigned 
char)val.bytes[1];
-                               return static_cast<long long>(intValue / 256.0);
-                       }
-               }
-               return -1;
+               return result;
        }
 
        kern_return_t SMCConnection::SMCReadKey(UInt32Char_t key, SMCVal_t 
*val) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btop-1.1.3/src/osx/smc.hpp 
new/btop-1.1.4/src/osx/smc.hpp
--- old/btop-1.1.3/src/osx/smc.hpp      2021-12-11 18:22:08.000000000 +0100
+++ new/btop-1.1.4/src/osx/smc.hpp      2021-12-29 14:40:32.000000000 +0100
@@ -1,3 +1,21 @@
+/* Copyright 2021 Aristocratos (ja...@qvantnet.com)
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+indent = tab
+tab-size = 4
+*/
+
 #pragma once
 
 #include <CoreFoundation/CoreFoundation.h>
@@ -26,7 +44,8 @@
 
 // key values
 #define SMC_KEY_CPU_TEMP "TC0P" // proximity temp?
-#define SMC_KEY_CPU_DIE_TEMP "TC0D" // die temp?
+#define SMC_KEY_CPU_DIODE_TEMP "TC0D" // diode temp?
+#define SMC_KEY_CPU_DIE_TEMP "TC0F" // die temp?
 #define SMC_KEY_CPU1_TEMP "TC1C"
 #define SMC_KEY_CPU2_TEMP "TC2C"  // etc
 #define SMC_KEY_FAN0_RPM_CUR "F0Ac"
@@ -86,6 +105,7 @@
 
           private:
         kern_return_t SMCReadKey(UInt32Char_t key, SMCVal_t *val);
+               long long getSMCTemp(char *key);
                kern_return_t SMCCall(int index, SMCKeyData_t *inputStructure, 
SMCKeyData_t *outputStructure);
 
                io_connect_t conn;

Reply via email to