Binary files /tmp/tmpSGrDSd/7T7GTA8RMn/r-cran-ps-1.2.1/build/ps.pdf and /tmp/tmpSGrDSd/R5AtHwvXFn/r-cran-ps-1.3.0/build/ps.pdf differ diff -Nru r-cran-ps-1.2.1/debian/changelog r-cran-ps-1.3.0/debian/changelog --- r-cran-ps-1.2.1/debian/changelog 2018-11-07 17:30:17.000000000 +0000 +++ r-cran-ps-1.3.0/debian/changelog 2019-01-04 18:11:13.000000000 +0000 @@ -1,3 +1,11 @@ +r-cran-ps (1.3.0-1) unstable; urgency=medium + + * Team upload. + * New upstream version + * Standards-Version: 4.3.0 + + -- Dylan Aïssi Fri, 04 Jan 2019 19:11:13 +0100 + r-cran-ps (1.2.1-1) unstable; urgency=medium * Team upload. diff -Nru r-cran-ps-1.2.1/debian/control r-cran-ps-1.3.0/debian/control --- r-cran-ps-1.2.1/debian/control 2018-11-07 17:30:17.000000000 +0000 +++ r-cran-ps-1.3.0/debian/control 2019-01-04 18:11:13.000000000 +0000 @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 11~), dh-r, r-base-dev -Standards-Version: 4.2.1 +Standards-Version: 4.3.0 Vcs-Browser: https://salsa.debian.org/r-pkg-team/r-cran-ps Vcs-Git: https://salsa.debian.org/r-pkg-team/r-cran-ps.git Homepage: https://cran.r-project.org/package=ps diff -Nru r-cran-ps-1.2.1/DESCRIPTION r-cran-ps-1.3.0/DESCRIPTION --- r-cran-ps-1.2.1/DESCRIPTION 2018-11-06 12:40:03.000000000 +0000 +++ r-cran-ps-1.3.0/DESCRIPTION 2018-12-21 14:50:03.000000000 +0000 @@ -1,5 +1,5 @@ Package: ps -Version: 1.2.1 +Version: 1.3.0 Title: List, Query, Manipulate System Processes Description: List, query and manipulate all system processes, on 'Windows', 'Linux' and 'macOS'. @@ -17,10 +17,10 @@ Imports: utils Suggests: callr, covr, curl, pingr, processx (>= 3.1.0), R6, rlang, testthat, tibble -RoxygenNote: 6.1.0 +RoxygenNote: 6.1.1 Biarch: true NeedsCompilation: yes -Packaged: 2018-11-06 10:09:10 UTC; gaborcsardi +Packaged: 2018-12-20 20:34:33 UTC; gaborcsardi Author: Jay Loden [aut], Dave Daeschler [aut], Giampaolo Rodola' [aut], @@ -28,4 +28,4 @@ RStudio [cph] Maintainer: Gábor Csárdi Repository: CRAN -Date/Publication: 2018-11-06 12:40:02 UTC +Date/Publication: 2018-12-21 14:50:03 UTC diff -Nru r-cran-ps-1.2.1/man/ps_cpu_count.Rd r-cran-ps-1.3.0/man/ps_cpu_count.Rd --- r-cran-ps-1.2.1/man/ps_cpu_count.Rd 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-ps-1.3.0/man/ps_cpu_count.Rd 2018-12-20 20:08:43.000000000 +0000 @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/system.R +\name{ps_cpu_count} +\alias{ps_cpu_count} +\title{Number of logical or phyisical CPUs} +\usage{ +ps_cpu_count(logical = TRUE) +} +\arguments{ +\item{logical}{Whether to count logical CPUs.} +} +\value{ +Integer scalar. +} +\description{ +If cannot be determined, it returns \code{NA}. It also returns \code{NA} on older +Windows systems, e.g. Vista or older and Windows Server 2008 or older. +} +\section{Examples}{ +\Sexpr[stage=install,strip.white=FALSE,results=rd]{ps:::decorate_examples(' +ps_cpu_count(logical = TRUE) +ps_cpu_count(logical = FALSE) +')} +} diff -Nru r-cran-ps-1.2.1/MD5 r-cran-ps-1.3.0/MD5 --- r-cran-ps-1.2.1/MD5 2018-11-06 12:40:03.000000000 +0000 +++ r-cran-ps-1.3.0/MD5 2018-12-21 14:50:03.000000000 +0000 @@ -1,21 +1,21 @@ -a60b8db82634b2fdad19b6f43fbe16ab *DESCRIPTION +71778a553caa2470325e3cc64152ad71 *DESCRIPTION 94619cda11226dcde8ce0a041fc99787 *LICENSE -d949c44929b931d2bb3ecbd5c2fcb1dd *NAMESPACE -aa1dc28f51b0edbde0c1991feb978c14 *NEWS.md +cb5cd2ed8bacfa0cb4584b8f341cea7f *NAMESPACE +1c4ab777658d56374260165645105e30 *NEWS.md e9d5da70cc329bca4418e19af321c9b8 *R/error.R fa0ca42199d6582915ec271ed7d66ae1 *R/kill-tree.R -23e2a93a869ade6aa7820ea58db8a68a *R/linux.R +90bc407f2d569592b9a1535539bc95dc *R/linux.R d5ef80609751f3040fe70a35cb0a36ba *R/low-level.R 389340f5fee7127eb63eee1361cdd84d *R/memoize.R 133103dc881fc2cb34ff7b3328c0d03e *R/os.R -3c54ecc199ee44fb33bfc2b21af3ded2 *R/package.R +c9251bd3db34af080f5fe5efd4a5d350 *R/package.R b30caf5fdcffcc02c0d35ef4fb72210c *R/posix.R d5beb6502a773f4ddb3b754099d1fea1 *R/ps.R -fa4d703144abb03f03becc446ed1b16f *R/system.R +410ce1cece13187397cc14cd2fd6d767 *R/system.R 6da412a264dbd60023d5cce65f45eb15 *R/testthat-reporter.R 6cb6e332816afc6f47e8e72c1470dd07 *R/utils.R be898c7cc0323566b2743c797dd71db8 *README.md -bd319e16f5f9cc7a8a367de8afd6881d *build/ps.pdf +65bc873c8f944475e767abdf927c269b *build/ps.pdf d8d31b225a4792ba5158a39713b5b269 *cleanup 8e56cea9c2aee717624a51b7fa1c7cf6 *configure 757ef8281ef2a1ebcbcc8235aeee2d0e *configure.win @@ -27,6 +27,7 @@ 6c0327aa6f425e6b4be3b1009cdb361b *man/ps_children.Rd 414f6e0ffeeb98fb2b5322b9c8175217 *man/ps_cmdline.Rd b8c3c131f3a4d1a00232fc36fbe02067 *man/ps_connections.Rd +6ab27dcd18c756b8faf43e39cfdc9383 *man/ps_cpu_count.Rd b2c23c956bdb0cda14eb320359df3f8e *man/ps_cpu_times.Rd 694b1cbb874d7aa5601763bb0154d384 *man/ps_create_time.Rd 1c6a109c7e449e8ecff48c9527694d28 *man/ps_cwd.Rd @@ -58,11 +59,11 @@ b90f28ca6453b80a98510a27fd9f764b *man/signals.Rd 8b20a5ff62cc7919eb4a8ac938774b8e *src/Makevars.in 75700dbd461864d933fd17e6912466e2 *src/api-common.c -b8d2937ade8cd5f7b12910c6db65f0ec *src/api-linux.c -9be7f4f7f3b569432188f86181c7a592 *src/api-macos.c +776048d1a9614e8bf48f255d651aceaf *src/api-linux.c +3f6ace45949ab4199e52f7a5589275d9 *src/api-macos.c 263b485fb729fa5bd99733f3657089c3 *src/api-posix.c 2f66c9907cb31f96a470ddc5d9cdce0b *src/api-windows-conn.c -46ceef090ae2f514fb13e1a5bd2b750e *src/api-windows.c +959d5bc6ca24a9115a57b6d72072590c *src/api-windows.c e989b00b4e7def6773b74fe49dd7b7d1 *src/arch/macos/process_info.c 04622dcb75db2e95b3ae1419ef31499c *src/arch/macos/process_info.h 54db4d328cd7d820788ba526734022e3 *src/arch/windows/ntextapi.h @@ -72,9 +73,9 @@ 4034d71409076ddf215011db0fd555c1 *src/arch/windows/process_info.h b7a7ac50cb410145903205da2427a2a5 *src/common.c e1046ca769d4da994b1a60825b7b1855 *src/common.h -d42267a00c1863ccf450f8968aee5445 *src/dummy.c +94458e16b454a43202a834df6196849e *src/dummy.c ce10c82a34d03bb71c90ca98c76a5194 *src/extra.c -aadb03f3f1b8bfc71bd93387823788f3 *src/init.c +f96e424745410d3f509eff00df6871b4 *src/init.c 25293087d29ce032315b03ca28b91cf7 *src/install.libs.R 3db35656c2495dee4cbe752196cb47b0 *src/interrupt.c 037bf6f2bd5b56c0a4638a291c6aed57 *src/linux.c @@ -82,7 +83,7 @@ bd8cc28ceeaef8fca0b74b3a0d5d7a74 *src/posix.c 0ae15b91452de2b2193049c64a162977 *src/posix.h 11d3a20cd8f247217241a6f80c2948f0 *src/ps-internal.h -bfdaddf0fcd6295ec4965b82a169d217 *src/ps.h +af95928c9aa9ddd11d408a8b00705d86 *src/ps.h 1c3a7249c43683980b9778c9e5adbe87 *src/px.c 33000cc1064ffade988569a9463bff93 *src/windows.c 5795cd4a210d26008a52fbd7b624d87f *src/windows.h @@ -98,6 +99,6 @@ 475b94523faffd01284aae14abed1492 *tests/testthat/test-pid-reuse.R 075a9193d3a2ec8c9bc380d4928f5c58 *tests/testthat/test-posix-zombie.R fa94aa2a182b4fb13d2aaa0554befc8e *tests/testthat/test-posix.R -49e96e17e41cfb246ac602fdeddd3ffa *tests/testthat/test-system.R +8bf2aade7ae0ba33a5db859393ef1478 *tests/testthat/test-system.R 230a86e4f3627388c2666c543b8d2631 *tests/testthat/test-utils.R 64704b900b93cad85ebb1d24deac7680 *tests/testthat/test-windows.R diff -Nru r-cran-ps-1.2.1/NAMESPACE r-cran-ps-1.3.0/NAMESPACE --- r-cran-ps-1.2.1/NAMESPACE 2018-10-25 21:15:56.000000000 +0000 +++ r-cran-ps-1.3.0/NAMESPACE 2018-12-20 20:08:43.000000000 +0000 @@ -10,6 +10,7 @@ export(ps_children) export(ps_cmdline) export(ps_connections) +export(ps_cpu_count) export(ps_cpu_times) export(ps_create_time) export(ps_cwd) diff -Nru r-cran-ps-1.2.1/NEWS.md r-cran-ps-1.3.0/NEWS.md --- r-cran-ps-1.2.1/NEWS.md 2018-11-06 10:08:24.000000000 +0000 +++ r-cran-ps-1.3.0/NEWS.md 2018-12-20 20:33:43.000000000 +0000 @@ -1,4 +1,9 @@ +# ps 1.3.0 + +* New `ps_cpu_count()` function returns the number of logical or + physical processors. + # ps 1.2.1 * Fix a crash on Linux, that happened at load time (#50). diff -Nru r-cran-ps-1.2.1/R/linux.R r-cran-ps-1.3.0/R/linux.R --- r-cran-ps-1.2.1/R/linux.R 2018-10-07 15:38:34.000000000 +0000 +++ r-cran-ps-1.3.0/R/linux.R 2018-12-20 20:08:43.000000000 +0000 @@ -139,3 +139,29 @@ list(addrs, port) } } + +ps_cpu_count_physical_linux <- function() { + lines <- readLines("/proc/cpuinfo") + mapping = list() + current = list() + + for (l in lines) { + l <- tolower(str_strip(l)) + if (!nchar(l)) { + if ("physical id" %in% names(current) && + "cpu cores" %in% names(current)) { + mapping[[ current[["physical id"]] ]] <- current[["cpu cores"]] + } + current <- list() + + } else { + if (str_starts_with(l, "physical id") || + str_starts_with(l, "cpu cores")) { + kv <- strsplit(l, "\\t+:")[[1]] + current[[ kv[[1]] ]] <- kv[[2]] + } + } + } + + sum(as.integer(unlist(mapping))) +} diff -Nru r-cran-ps-1.2.1/R/package.R r-cran-ps-1.3.0/R/package.R --- r-cran-ps-1.2.1/R/package.R 2018-10-07 15:38:34.000000000 +0000 +++ r-cran-ps-1.3.0/R/package.R 2018-12-20 20:08:43.000000000 +0000 @@ -25,6 +25,8 @@ Internal <<- get(".Internal", asNamespace("base")) ps_boot_time <<- memoize(ps_boot_time) + ps_cpu_count_logical <<- memoize(ps_cpu_count_logical) + ps_cpu_count_physical <<- memoize(ps_cpu_count_physical) get_terminal_map <<- memoize(get_terminal_map) NA_time <<- memoize(NA_time) } diff -Nru r-cran-ps-1.2.1/R/system.R r-cran-ps-1.3.0/R/system.R --- r-cran-ps-1.2.1/R/system.R 2018-08-07 21:45:48.000000000 +0000 +++ r-cran-ps-1.3.0/R/system.R 2018-12-20 20:08:43.000000000 +0000 @@ -74,3 +74,38 @@ class(d) <- unique(c("tbl_df", "tbl", class(d))) d } + +#' Number of logical or phyisical CPUs +#' +#' If cannot be determined, it returns `NA`. It also returns `NA` on older +#' Windows systems, e.g. Vista or older and Windows Server 2008 or older. +#' +#' @param logical Whether to count logical CPUs. +#' @return Integer scalar. +#' +#' @export +#' +#' @rawRd +#' \section{Examples}{ +#' \Sexpr[stage=install,strip.white=FALSE,results=rd]{ps:::decorate_examples(' +#' ps_cpu_count(logical = TRUE) +#' ps_cpu_count(logical = FALSE) +#' ')} +#' } + +ps_cpu_count <- function(logical = TRUE) { + assert_flag(logical) + if (logical) ps_cpu_count_logical() else ps_cpu_count_physical() +} + + ps_cpu_count_logical <- function() { + .Call(ps__cpu_count_logical) + } + +ps_cpu_count_physical <- function() { + if (ps_os_type()[["LINUX"]]) { + ps_cpu_count_physical_linux() + } else { + .Call(ps__cpu_count_physical) + } +} diff -Nru r-cran-ps-1.2.1/src/api-linux.c r-cran-ps-1.3.0/src/api-linux.c --- r-cran-ps-1.2.1/src/api-linux.c 2018-11-06 10:09:10.000000000 +0000 +++ r-cran-ps-1.3.0/src/api-linux.c 2018-12-20 20:34:33.000000000 +0000 @@ -794,6 +794,18 @@ return ScalarReal(psll_linux_boot_time); } +SEXP ps__cpu_count_logical() { + int n = sysconf(_SC_NPROCESSORS_ONLN); + if (n >= 1) return ScalarInteger(n); + return(ScalarInteger(NA_INTEGER)); +} + +/* This is not used, because it is much easier to parse this file from R */ + +SEXP ps__cpu_count_physical() { + return R_NilValue; +} + static int psl__linux_match_environ(SEXP r_marker, SEXP r_pid) { const char *marker = CHAR(STRING_ELT(r_marker, 0)); pid_t pid = INTEGER(r_pid)[0]; diff -Nru r-cran-ps-1.2.1/src/api-macos.c r-cran-ps-1.3.0/src/api-macos.c --- r-cran-ps-1.2.1/src/api-macos.c 2018-11-06 10:09:10.000000000 +0000 +++ r-cran-ps-1.3.0/src/api-macos.c 2018-12-20 20:34:33.000000000 +0000 @@ -456,6 +456,26 @@ return ScalarReal(unixtime); } +SEXP ps__cpu_count_logical() { + int num = 0; + size_t size = sizeof(int); + + if (sysctlbyname("hw.logicalcpu", &num, &size, NULL, 2)) + return ScalarInteger(NA_INTEGER); + else + return ScalarInteger(num); +} + +SEXP ps__cpu_count_physical() { + int num = 0; + size_t size = sizeof(int); + + if (sysctlbyname("hw.physicalcpu", &num, &size, NULL, 0)) + return ScalarInteger(NA_INTEGER); + else + return ScalarInteger(num); +} + SEXP ps__kill_if_env(SEXP marker, SEXP after, SEXP pid, SEXP sig) { const char *cmarker = CHAR(STRING_ELT(marker, 0)); pid_t cpid = INTEGER(pid)[0]; diff -Nru r-cran-ps-1.2.1/src/api-windows.c r-cran-ps-1.3.0/src/api-windows.c --- r-cran-ps-1.2.1/src/api-windows.c 2018-11-06 10:09:10.000000000 +0000 +++ r-cran-ps-1.3.0/src/api-windows.c 2018-12-20 20:34:33.000000000 +0000 @@ -582,6 +582,147 @@ } } +/* + * Return the number of logical, active CPUs. Return 0 if undetermined. + * See discussion at: https://bugs.python.org/issue33166#msg314631 + */ +#if (_WIN32_WINNT < 0x0601) // < Windows 7 (namely Vista and XP) + +SEXP ps__cpu_count_logical() { + return ScalarInteger(NA_INTEGER); +} + +SEXP ps__cpu_count_physical() { + return ScalarInteger(NA_INTEGER); +} + +#else // Windows >= 7 + +unsigned int ps__get_num_cpus(int fail_on_err) { + unsigned int ncpus = 0; + SYSTEM_INFO sysinfo; + static DWORD(CALLBACK *_GetActiveProcessorCount)(WORD) = NULL; + HINSTANCE hKernel32; + + // GetActiveProcessorCount is available only on 64 bit versions + // of Windows from Windows 7 onward. + // Windows Vista 64 bit and Windows XP doesn't have it. + hKernel32 = GetModuleHandleW(L"KERNEL32"); + _GetActiveProcessorCount = (void*)GetProcAddress( + hKernel32, "GetActiveProcessorCount"); + + if (_GetActiveProcessorCount != NULL) { + ncpus = _GetActiveProcessorCount(ALL_PROCESSOR_GROUPS); + if ((ncpus == 0) && (fail_on_err == 1)) { + ps__set_error_from_windows_error(0); + } + } else { + ps__debug("GetActiveProcessorCount() not available; " + "using GetNativeSystemInfo()"); + GetNativeSystemInfo(&sysinfo); + ncpus = (unsigned int) sysinfo.dwNumberOfProcessors; + if ((ncpus == 0) && (fail_on_err == 1)) { + ps__set_error("GetNativeSystemInfo() failed to retrieve CPU count"); + ps__throw_error(); + } + } + + return ncpus; +} + +SEXP ps__cpu_count_logical() { + unsigned int ncpus; + + ncpus = ps__get_num_cpus(0); + if (ncpus != 0) { + return ScalarInteger(ncpus); + } else { + return ScalarInteger(NA_INTEGER); + } +} + +typedef BOOL (WINAPI *LPFN_GLPI)( + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, + PDWORD); + +// Helper function to count set bits in the processor mask. +DWORD ps__count_set_bits(ULONG_PTR bitMask) { + DWORD LSHIFT = sizeof(ULONG_PTR)*8 - 1; + DWORD bitSetCount = 0; + ULONG_PTR bitTest = (ULONG_PTR)1 << LSHIFT; + DWORD i; + + for (i = 0; i <= LSHIFT; ++i) { + bitSetCount += ((bitMask & bitTest)?1:0); + bitTest/=2; + } + + return bitSetCount; +} + +SEXP ps__cpu_count_physical() { + LPFN_GLPI glpi; + BOOL done = FALSE; + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = NULL; + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = NULL; + DWORD returnLength = 0; + DWORD nproc = 0; + DWORD byteOffset = 0; + + glpi = (LPFN_GLPI) GetProcAddress( + GetModuleHandle(TEXT("kernel32")), + "GetLogicalProcessorInformation"); + + if (NULL == glpi) return ScalarInteger(NA_INTEGER); + + while (!done) { + DWORD rc = glpi(buffer, &returnLength); + + if (FALSE == rc) { + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + if (buffer) free(buffer); + buffer = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION) malloc(returnLength); + + if (NULL == buffer) { + ps__no_memory(""); + ps__throw_error(); + } + } else { + ps__set_error_from_windows_error(0); + ps__throw_error(); + } + } else { + done = TRUE; + } + } + + ptr = buffer; + + while (byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength) { + + switch (ptr->Relationship) { + case RelationProcessorCore: + // A hyperthreaded core supplies more than one logical processor. + nproc += ps__count_set_bits(ptr->ProcessorMask); + break; + default: + break; + } + + byteOffset += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION); + ptr++; + } + + free(buffer); + + if (nproc > 0) { + return ScalarInteger(nproc); + } else { + return ScalarInteger(NA_INTEGER); + } +} +#endif + SEXP ps__kill_if_env(SEXP marker, SEXP after, SEXP pid, SEXP sig) { const char *cmarker = CHAR(STRING_ELT(marker, 0)); double cafter = REAL(after)[0]; diff -Nru r-cran-ps-1.2.1/src/dummy.c r-cran-ps-1.3.0/src/dummy.c --- r-cran-ps-1.2.1/src/dummy.c 2018-11-06 10:09:10.000000000 +0000 +++ r-cran-ps-1.3.0/src/dummy.c 2018-12-20 20:34:33.000000000 +0000 @@ -48,6 +48,8 @@ #ifndef PS__WINDOWS void ps__pids() { ps__dummy("ps_pids"); } void ps__boot_time() { ps__dummy("ps_boot_time"); } +void ps__cpu_count_logical() { ps__dummy("ps_cpu_count"); } +void ps__cpu_count_physical() { ps__dummy("ps_cpu_count"); } void ps__users() { ps__users("ps_users"); } void psll_handle() { ps__dummy("ps_handle"); } diff -Nru r-cran-ps-1.2.1/src/init.c r-cran-ps-1.3.0/src/init.c --- r-cran-ps-1.2.1/src/init.c 2018-11-06 10:09:10.000000000 +0000 +++ r-cran-ps-1.3.0/src/init.c 2018-12-20 20:34:33.000000000 +0000 @@ -6,10 +6,12 @@ static const R_CallMethodDef callMethods[] = { /* System api */ - { "ps__os_type", (DL_FUNC) ps__os_type, 0 }, - { "ps__pids", (DL_FUNC) ps__pids, 0 }, - { "ps__boot_time", (DL_FUNC) ps__boot_time, 0 }, - { "ps__users", (DL_FUNC) ps__users, 0 }, + { "ps__os_type", (DL_FUNC) ps__os_type, 0 }, + { "ps__pids", (DL_FUNC) ps__pids, 0 }, + { "ps__boot_time", (DL_FUNC) ps__boot_time, 0 }, + { "ps__cpu_count_logical", (DL_FUNC) ps__cpu_count_logical, 0 }, + { "ps__cpu_count_physical", (DL_FUNC) ps__cpu_count_physical, 0 }, + { "ps__users", (DL_FUNC) ps__users, 0 }, /* ps_handle API */ { "psll_pid", (DL_FUNC) psll_pid, 1 }, diff -Nru r-cran-ps-1.2.1/src/ps.h r-cran-ps-1.3.0/src/ps.h --- r-cran-ps-1.2.1/src/ps.h 2018-11-06 10:09:10.000000000 +0000 +++ r-cran-ps-1.3.0/src/ps.h 2018-12-20 20:34:33.000000000 +0000 @@ -46,6 +46,8 @@ SEXP ps__os_type(); SEXP ps__pids(); SEXP ps__boot_time(); +SEXP ps__cpu_count_logical(); +SEXP ps__cpu_count_physical(); SEXP ps__users(); /* Generic utils used from R */ diff -Nru r-cran-ps-1.2.1/tests/testthat/test-system.R r-cran-ps-1.3.0/tests/testthat/test-system.R --- r-cran-ps-1.2.1/tests/testthat/test-system.R 2018-08-07 21:45:48.000000000 +0000 +++ r-cran-ps-1.3.0/tests/testthat/test-system.R 2018-12-20 20:08:43.000000000 +0000 @@ -56,3 +56,11 @@ test_that("ps_users runs", { expect_error(ps_users(), NA) }) + +test_that("ps_cpu_count", { + log <- ps_cpu_count(logical = TRUE) + phy <- ps_cpu_count(logical = FALSE) + if (!is.na(log) && !is.na(phy)) expect_true(log >= phy) + if (!is.na(log)) expect_true(log > 0) + if (!is.na(phy)) expect_true(phy > 0) +})