proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/query/customized/PhrasePositions.java | PhrasePositions | nextPosition | class PhrasePositions {
int position; // position in doc
int count; // remaining pos in this doc
int offset; // position in phrase
final int ord; // unique across all PhrasePositions instances
final PostingsEnum postings; // st... |
if (count-- > 0) { // read subsequent pos's
position = postings.nextPosition() - offset;
return true;
} else {
return false;
}
| 399 | 51 | 450 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/query/customized/PhraseQueue.java | PhraseQueue | lessThan | class PhraseQueue extends PriorityQueue<PhrasePositions> {
PhraseQueue(int size) {
super(size);
}
@Override
protected boolean lessThan(PhrasePositions pp1, PhrasePositions pp2) {<FILL_FUNCTION_BODY>}
} |
if (pp1.position == pp2.position) {
// same doc and pp.position, so decide by actual term positions.
// rely on: pp.position == tp.position - offset.
if (pp1.offset == pp2.offset) {
return pp1.ord < pp2.ord;
} else {
return pp1.off... | 78 | 122 | 200 | <no_super_class> |
oracle_opengrok | opengrok/suggester/src/main/java/org/opengrok/suggest/util/Progress.java | Progress | getLevel | class Progress implements AutoCloseable {
private final Logger logger;
private final Long totalCount;
private final String suffix;
private final AtomicLong currentCount = new AtomicLong();
private final Map<Level, Integer> levelCountMap = new TreeMap<>(Comparator.comparingInt(Level::intValue).rever... |
// The intention is to log the initial and final count at the base log level.
if (currentCount <= 1 || (totalCount != null && currentCount == totalCount)) {
currentLevel = baseLogLevel;
} else {
// Set the log level based on the "buckets".
for (var levelCount... | 1,249 | 160 | 1,409 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/SystemInfo.java | SystemInfo | createOperatingSystem | class SystemInfo {
// The platform isn't going to change, and making this static enables easy
// access from outside this class
private static final PlatformEnum CURRENT_PLATFORM = PlatformEnum.getValue(Platform.getOSType());
private static final String NOT_SUPPORTED = "Operating system not supported:... |
switch (CURRENT_PLATFORM) {
case WINDOWS:
return new WindowsOperatingSystem();
case LINUX:
case ANDROID:
return new LinuxOperatingSystem();
case MACOS:
return new MacOperatingSystem();
case SOLARIS:
return new SolarisOperat... | 755 | 172 | 927 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/Devicetree.java | Devicetree | queryModel | class Devicetree {
private Devicetree() {
}
/**
* Query the model from the devicetree
*
* @return The model if available, null otherwise
*/
public static String queryModel() {<FILL_FUNCTION_BODY>}
} |
String modelStr = FileUtil.getStringFromFile(SysPath.MODEL);
if (!modelStr.isEmpty()) {
return modelStr.replace("Machine: ", "");
}
return null;
| 77 | 54 | 131 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/Dmidecode.java | Dmidecode | queryUUID | class Dmidecode {
private Dmidecode() {
}
// $ sudo dmidecode -t bios
// # dmidecode 2.11
// SMBIOS 2.4 present.
//
// Handle 0x0000, DMI type 0, 24 bytes
// BIOS Information
// Vendor: Phoenix Technologies LTD
// Version: 6.00
// Release Date: 07/02/2015
// Address: 0x... |
// If root privileges this will work
if (UserGroupInfo.isElevated()) {
String marker = "UUID:";
for (String checkLine : ExecutingCommand.runNative("dmidecode -t system")) {
if (checkLine.contains(marker)) {
return checkLine.split(marker)[1].tr... | 921 | 100 | 1,021 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/Lshal.java | Lshal | queryUUID | class Lshal {
private Lshal() {
}
/**
* Query the serial number from lshal
*
* @return The serial number if available, null otherwise
*/
public static String querySerialNumber() {
// if lshal command available (HAL deprecated in newer linuxes)
String marker = "syste... |
// if lshal command available (HAL deprecated in newer linuxes)
String marker = "system.hardware.uuid =";
for (String checkLine : ExecutingCommand.runNative("lshal")) {
if (checkLine.contains(marker)) {
return ParseUtil.getSingleQuoteStringValue(checkLine);
... | 208 | 95 | 303 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/Lshw.java | Lshw | queryCpuCapacity | class Lshw {
private Lshw() {
}
private static final String MODEL;
private static final String SERIAL;
private static final String UUID;
static {
String model = null;
String serial = null;
String uuid = null;
if (UserGroupInfo.isElevated()) {
String... |
String capacityMarker = "capacity:";
for (String checkLine : ExecutingCommand.runNative("lshw -class processor")) {
if (checkLine.contains(capacityMarker)) {
return ParseUtil.parseHertz(checkLine.split(capacityMarker)[1].trim());
}
}
return -1L;
... | 490 | 89 | 579 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/Sysfs.java | Sysfs | queryProductModel | class Sysfs {
private Sysfs() {
}
/**
* Query the vendor from sysfs
*
* @return The vendor if available, null otherwise
*/
public static String querySystemVendor() {
final String sysVendor = FileUtil.getStringFromFile(SysPath.DMI_ID + "sys_vendor").trim();
if (!sysV... |
final String productName = FileUtil.getStringFromFile(SysPath.DMI_ID + "product_name").trim();
final String productVersion = FileUtil.getStringFromFile(SysPath.DMI_ID + "product_version").trim();
if (productName.isEmpty()) {
if (!productVersion.isEmpty()) {
return pr... | 1,348 | 151 | 1,499 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/Who.java | Who | queryUtxent | class Who {
private static final LinuxLibc LIBC = LinuxLibc.INSTANCE;
private Who() {
}
/**
* Query {@code getutxent} to get logged in users.
*
* @return A list of logged in user sessions
*/
public static synchronized List<OSSession> queryUtxent() {<FILL_FUNCTION_BODY>}
} |
List<OSSession> whoList = new ArrayList<>();
LinuxUtmpx ut;
// Rewind
LIBC.setutxent();
try {
// Iterate
while ((ut = LIBC.getutxent()) != null) {
if (ut.ut_type == USER_PROCESS || ut.ut_type == LOGIN_PROCESS) {
String ... | 104 | 317 | 421 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/proc/Auxv.java | Auxv | queryAuxv | class Auxv {
private Auxv() {
}
public static final int AT_PAGESZ = 6; // system page size
public static final int AT_HWCAP = 16; // arch dependent hints at CPU capabilities
public static final int AT_CLKTCK = 17; // frequency at which times() increments
/**
* Retrieve the auxiliary vect... |
ByteBuffer buff = FileUtil.readAllBytesAsBuffer(ProcPath.AUXV);
Map<Integer, Long> auxvMap = new HashMap<>();
int key;
do {
key = FileUtil.readNativeLongFromBuffer(buff).intValue();
if (key > 0) {
auxvMap.put(key, FileUtil.readNativeLongFromBuffer... | 202 | 123 | 325 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/proc/CpuInfo.java | CpuInfo | queryBoardInfo | class CpuInfo {
private CpuInfo() {
}
/**
* Gets the CPU manufacturer from {@code /proc/cpuinfo}
*
* @return The manufacturer if known, null otherwise
*/
public static String queryCpuManufacturer() {
List<String> cpuInfo = FileUtil.readFile(CPUINFO);
for (String lin... |
String pcManufacturer = null;
String pcModel = null;
String pcVersion = null;
String pcSerialNumber = null;
List<String> cpuInfo = FileUtil.readFile(CPUINFO);
for (String line : cpuInfo) {
String[] splitLine = ParseUtil.whitespacesColonWhitespace.split(line)... | 667 | 262 | 929 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/proc/CpuStat.java | CpuStat | getSystemCpuLoadTicks | class CpuStat {
private CpuStat() {
}
/**
* Gets the System CPU ticks array from {@code /proc/stat}
*
* @return Array of CPU ticks
*/
public static long[] getSystemCpuLoadTicks() {<FILL_FUNCTION_BODY>}
/**
* Gets an arrya of Processor CPU ticks array from /proc/stat
... |
long[] ticks = new long[TickType.values().length];
// /proc/stat expected format
// first line is overall user,nice,system,idle,iowait,irq, etc.
// cpu 3357 0 4313 1362393 ...
String tickStr;
List<String> procStat = FileUtil.readLines(ProcPath.STAT, 1);
if (procS... | 1,086 | 357 | 1,443 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/proc/DiskStats.java | DiskStats | getDiskStats | class DiskStats {
/**
* Enum corresponding to the fields in the output of {@code /proc/diskstats}
*/
public enum IoStat {
/**
* The device major number.
*/
MAJOR,
/**
* The device minor number.
*/
MINOR,
/**
* The de... |
Map<String, Map<IoStat, Long>> diskStatMap = new HashMap<>();
IoStat[] enumArray = IoStat.class.getEnumConstants();
List<String> diskStats = FileUtil.readFile(ProcPath.DISKSTATS);
for (String stat : diskStats) {
String[] split = ParseUtil.whitespaces.split(stat.trim());
... | 777 | 256 | 1,033 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/linux/proc/UpTime.java | UpTime | getSystemUptimeSeconds | class UpTime {
private UpTime() {
}
/**
* Parses the first value in {@code /proc/uptime} for seconds since boot
*
* @return Seconds since boot
*/
public static double getSystemUptimeSeconds() {<FILL_FUNCTION_BODY>}
} |
String uptime = FileUtil.getStringFromFile(ProcPath.UPTIME);
int spaceIndex = uptime.indexOf(' ');
if (spaceIndex < 0) {
// No space, error
return 0d;
}
return ParseUtil.parseDoubleOrDefault(uptime.substring(0, spaceIndex), 0d);
| 85 | 90 | 175 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/mac/ThreadInfo.java | ThreadInfo | queryTaskThreads | class ThreadInfo {
private static final Pattern PS_M = Pattern.compile(
"\\D+(\\d+).+(\\d+\\.\\d)\\s+(\\w)\\s+(\\d+)\\D+(\\d+:\\d{2}\\.\\d{2})\\s+(\\d+:\\d{2}\\.\\d{2}).+");
private ThreadInfo() {
}
public static List<ThreadStats> queryTaskThreads(int pid) {<FILL_FUNCTION_BODY>}
/**
... |
String pidStr = " " + pid + " ";
List<ThreadStats> taskThreads = new ArrayList<>();
// Only way to get thread info without root permissions
// Using the M switch gives all threads with no possibility to filter
List<String> psThread = ExecutingCommand.runNative("ps -awwxM").strea... | 685 | 331 | 1,016 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/mac/Who.java | Who | queryUtxent | class Who {
private static final SystemB SYS = SystemB.INSTANCE;
private Who() {
}
/**
* Query {@code getutxent} to get logged in users.
*
* @return A list of logged in user sessions
*/
public static synchronized List<OSSession> queryUtxent() {<FILL_FUNCTION_BODY>}
} |
List<OSSession> whoList = new ArrayList<>();
MacUtmpx ut;
// Rewind
SYS.setutxent();
try { // Iterate
while ((ut = SYS.getutxent()) != null) {
if (ut.ut_type == USER_PROCESS || ut.ut_type == LOGIN_PROCESS) {
String user = Native.to... | 102 | 323 | 425 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/mac/WindowInfo.java | WindowInfo | queryDesktopWindows | class WindowInfo {
private WindowInfo() {
}
/**
* Gets windows on the operating system's GUI desktop.
*
* @param visibleOnly Whether to restrict the list to only windows visible to the user.
* @return A list of {@link oshi.software.os.OSDesktopWindow} objects representing the desktop w... |
CFArrayRef windowInfo = CoreGraphics.INSTANCE.CGWindowListCopyWindowInfo(
visibleOnly ? kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements
: kCGWindowListOptionAll,
kCGNullWindowID);
int numWindows = windowInfo.getCount();
... | 121 | 974 | 1,095 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/mac/disk/Fsstat.java | Fsstat | queryPartitionToMountMap | class Fsstat {
private Fsstat() {
}
/**
* Query fsstat to map partitions to mount points
*
* @return A map with partitions as the key and mount points as the value
*/
public static Map<String, String> queryPartitionToMountMap() {<FILL_FUNCTION_BODY>}
private static int queryFs... |
Map<String, String> mountPointMap = new HashMap<>();
// Use statfs to get size of mounted file systems
int numfs = queryFsstat(null, 0, 0);
// Get data on file system
Statfs s = new Statfs();
// Create array to hold results
Statfs[] fs = (Statfs[]) s.toArray(num... | 139 | 233 | 372 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/mac/net/NetStat.java | NetStat | queryIFdata | class NetStat {
private static final Logger LOG = LoggerFactory.getLogger(NetStat.class);
private static final int CTL_NET = 4;
private static final int PF_ROUTE = 17;
private static final int NET_RT_IFLIST2 = 6;
private static final int RTM_IFINFO2 = 0x12;
private NetStat() {
}
/**
... |
// Ported from source code of "netstat -ir". See
// https://opensource.apple.com/source/network_cmds/network_cmds-457/netstat.tproj/if.c
Map<Integer, IFdata> data = new HashMap<>();
// Get buffer of all interface information
int[] mib = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST2,... | 963 | 737 | 1,700 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/Who.java | Who | matchUnix | class Who {
// sample format:
// oshi pts/0 2020-05-14 21:23 (192.168.1.23)
private static final Pattern WHO_FORMAT_LINUX = Pattern
.compile("(\\S+)\\s+(\\S+)\\s+(\\d{4}-\\d{2}-\\d{2})\\s+(\\d{2}:\\d{2})\\s*(?:\\((.+)\\))?");
private static final DateTimeFormatter WHO_DATE_FORMAT_LINUX = Da... |
Matcher m = WHO_FORMAT_UNIX.matcher(s);
if (m.matches()) {
try {
// Missing year, parse date time with current year
LocalDateTime login = LocalDateTime.parse(m.group(3) + " " + m.group(4) + " " + m.group(5),
WHO_DATE_FORMAT_UNIX);
... | 920 | 275 | 1,195 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/Xrandr.java | Xrandr | getEdidArrays | class Xrandr {
private static final String[] XRANDR_VERBOSE = { "xrandr", "--verbose" };
private Xrandr() {
}
public static List<byte[]> getEdidArrays() {<FILL_FUNCTION_BODY>}
} |
// Special handling for X commands, don't use LC_ALL
List<String> xrandr = ExecutingCommand.runNative(XRANDR_VERBOSE, null);
// xrandr reports edid in multiple lines. After seeing a line containing
// EDID, read subsequent lines of hex until 256 characters are reached
if (xrandr... | 78 | 278 | 356 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/Xwininfo.java | Xwininfo | queryXWindows | class Xwininfo {
private static final String[] NET_CLIENT_LIST_STACKING = ParseUtil.whitespaces
.split("xprop -root _NET_CLIENT_LIST_STACKING");
private static final String[] XWININFO_ROOT_TREE = ParseUtil.whitespaces.split("xwininfo -root -tree");
private static final String[] XPROP_NET_WM_PID... |
// Attempted to implement using native X11 code. However, this produced native X
// errors (e.g., BadValue) which cannot be caught on the Java side and
// terminated the thread. Using x command lines which execute in a separate
// process. Errors are caught by the terminal process and s... | 425 | 875 | 1,300 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/Ls.java | Ls | queryDeviceMajorMinor | class Ls {
private Ls() {
}
/**
* Query {@code ls} to get parition info
*
* @return A map of device name to a major-minor pair
*/
public static Map<String, Pair<Integer, Integer>> queryDeviceMajorMinor() {<FILL_FUNCTION_BODY>}
} |
// Map major and minor from ls
/*-
$ ls -l /dev
brw-rw---- 1 root system 10, 5 Sep 12 2017 hd2
brw------- 1 root system 20, 0 Jun 28 1970 hdisk0
*/
Map<String, Pair<Integer, Integer>> majMinMap = new HashMap<>();
for (String s : ExecutingCommand.r... | 93 | 283 | 376 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/Lscfg.java | Lscfg | queryBackplaneModelSerialVersion | class Lscfg {
private Lscfg() {
}
/**
* Query {@code lscfg -vp} to get all hardware devices
*
* @return A list of the output
*/
public static List<String> queryAllDevices() {
return ExecutingCommand.runNative("lscfg -vp");
}
/**
* Parse the output of {@code ls... |
final String planeMarker = "WAY BACKPLANE";
final String modelMarker = "Part Number";
final String serialMarker = "Serial Number";
final String versionMarker = "Version";
final String locationMarker = "Physical Location";
// 1 WAY BACKPLANE :
// Serial Number...... | 534 | 433 | 967 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/Lspv.java | Lspv | computeLogicalVolumes | class Lspv {
/**
* The lspv command incurs a lot of disk reads. Since partitions shouldn't change during operation, cache the result
* here.
*/
private static final Map<String, List<HWPartition>> PARTITION_CACHE = new ConcurrentHashMap<>();
private Lspv() {
}
/**
* Query {@cod... |
List<HWPartition> partitions = new ArrayList<>();
/*-
$ lspv -L hdisk0
PHYSICAL VOLUME: hdisk0 VOLUME GROUP: rootvg
PV IDENTIFIER: 000acfde95524f85 VG IDENTIFIER 000acfde00004c000000000395525276
PV STATE: active
STALE ... | 353 | 1,493 | 1,846 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/Lssrad.java | Lssrad | queryNodesPackages | class Lssrad {
private Lssrad() {
}
/**
* Query {@code lssrad} to get numa node and physical package info
*
* @return A map of processor number to a pair containing the ref (NUMA equivalent) and srad (package)
*/
public static Map<Integer, Pair<Integer, Integer>> queryNodesPackages... |
/*-
# lssrad -av
REF1 SRAD MEM CPU
0
0 32749.12 0-63
1 9462.00 64-67 72-75
80-83 88-91
1
2 2471.19 92-95
2
... | 110 | 418 | 528 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/Uptime.java | Uptime | queryUpTime | class Uptime {
private static final long MINUTE_MS = 60L * 1000L;
private static final long HOUR_MS = 60L * MINUTE_MS;
private static final long DAY_MS = 24L * HOUR_MS;
// sample format:
// 18:36pm up 10 days 8:11, 2 users, load average: 3.14, 2.74, 2.41
private static final Pattern UPTIME_FO... |
long uptime = 0L;
String s = ExecutingCommand.getFirstAnswer("uptime");
if (s.isEmpty()) {
s = ExecutingCommand.getFirstAnswer("w");
}
if (s.isEmpty()) {
s = ExecutingCommand.getFirstAnswer("/usr/bin/uptime");
}
Matcher m = UPTIME_FORMAT_A... | 286 | 253 | 539 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/Who.java | Who | queryBootTime | class Who {
// sample format:
// system boot 2020-06-16 09:12
private static final Pattern BOOT_FORMAT_AIX = Pattern.compile("\\D+(\\d{4}-\\d{2}-\\d{2})\\s+(\\d{2}:\\d{2}).*");
private static final DateTimeFormatter BOOT_DATE_FORMAT_AIX = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm",
Loca... |
String s = ExecutingCommand.getFirstAnswer("who -b");
if (s.isEmpty()) {
s = ExecutingCommand.getFirstAnswer("/usr/bin/who -b");
}
Matcher m = BOOT_FORMAT_AIX.matcher(s);
if (m.matches()) {
try {
return LocalDateTime.parse(m.group(1) + " "... | 204 | 182 | 386 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatConfig.java | PerfstatConfig | queryConfig | class PerfstatConfig {
private static final Perfstat PERF = Perfstat.INSTANCE;
private PerfstatConfig() {
}
/**
* Queries perfstat_partition_config for config
*
* @return usage statistics
*/
public static perfstat_partition_config_t queryConfig() {<FILL_FUNCTION_BODY>}
} |
perfstat_partition_config_t config = new perfstat_partition_config_t();
int ret = PERF.perfstat_partition_config(null, config, config.size(), 1);
if (ret > 0) {
return config;
}
return new perfstat_partition_config_t();
| 99 | 82 | 181 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatCpu.java | PerfstatCpu | queryCpu | class PerfstatCpu {
private static final Perfstat PERF = Perfstat.INSTANCE;
private PerfstatCpu() {
}
/**
* Queries perfstat_cpu_total for total CPU usage statistics
*
* @return usage statistics
*/
public static perfstat_cpu_total_t queryCpuTotal() {
perfstat_cpu_total... |
perfstat_cpu_t cpu = new perfstat_cpu_t();
// With null, null, ..., 0, returns total # of elements
int cputotal = PERF.perfstat_cpu(null, null, cpu.size(), 0);
if (cputotal > 0) {
perfstat_cpu_t[] statp = (perfstat_cpu_t[]) cpu.toArray(cputotal);
perfstat_id_t fi... | 356 | 197 | 553 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatDisk.java | PerfstatDisk | queryDiskStats | class PerfstatDisk {
private static final Perfstat PERF = Perfstat.INSTANCE;
private PerfstatDisk() {
}
/**
* Queries perfstat_disk for per-disk usage statistics
*
* @return an array of usage statistics
*/
public static perfstat_disk_t[] queryDiskStats() {<FILL_FUNCTION_BODY>}... |
perfstat_disk_t diskStats = new perfstat_disk_t();
// With null, null, ..., 0, returns total # of elements
int total = PERF.perfstat_disk(null, null, diskStats.size(), 0);
if (total > 0) {
perfstat_disk_t[] statp = (perfstat_disk_t[]) diskStats.toArray(total);
pe... | 104 | 191 | 295 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatMemory.java | PerfstatMemory | queryMemoryTotal | class PerfstatMemory {
private static final Perfstat PERF = Perfstat.INSTANCE;
private PerfstatMemory() {
}
/**
* Queries perfstat_memory_total for total memory usage statistics
*
* @return usage statistics
*/
public static perfstat_memory_total_t queryMemoryTotal() {<FILL_FUN... |
perfstat_memory_total_t memory = new perfstat_memory_total_t();
int ret = PERF.perfstat_memory_total(null, memory, memory.size(), 1);
if (ret > 0) {
return memory;
}
return new perfstat_memory_total_t();
| 103 | 82 | 185 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatNetInterface.java | PerfstatNetInterface | queryNetInterfaces | class PerfstatNetInterface {
private static final Perfstat PERF = Perfstat.INSTANCE;
private PerfstatNetInterface() {
}
/**
* Queries perfstat_netinterface for per-netinterface usage statistics
*
* @return an array of usage statistics
*/
public static perfstat_netinterface_t[]... |
perfstat_netinterface_t netinterface = new perfstat_netinterface_t();
// With null, null, ..., 0, returns total # of elements
int total = PERF.perfstat_netinterface(null, null, netinterface.size(), 0);
if (total > 0) {
perfstat_netinterface_t[] statp = (perfstat_netinterface... | 110 | 198 | 308 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatProcess.java | PerfstatProcess | queryProcesses | class PerfstatProcess {
private static final Perfstat PERF = Perfstat.INSTANCE;
private PerfstatProcess() {
}
/**
* Queries perfstat_process for per-process usage statistics
*
* @return an array of usage statistics
*/
public static perfstat_process_t[] queryProcesses() {<FILL_... |
perfstat_process_t process = new perfstat_process_t();
// With null, null, ..., 0, returns total # of elements
int procCount = PERF.perfstat_process(null, null, process.size(), 0);
if (procCount > 0) {
perfstat_process_t[] proct = (perfstat_process_t[]) process.toArray(procC... | 104 | 197 | 301 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatProtocol.java | PerfstatProtocol | queryProtocols | class PerfstatProtocol {
private static final Perfstat PERF = Perfstat.INSTANCE;
private PerfstatProtocol() {
}
/**
* Queries perfstat_protocol for per-protocol usage statistics
*
* @return an array of usage statistics
*/
public static perfstat_protocol_t[] queryProtocols() {<... |
perfstat_protocol_t protocol = new perfstat_protocol_t();
// With null, null, ..., 0, returns total # of elements
int total = PERF.perfstat_protocol(null, null, protocol.size(), 0);
if (total > 0) {
perfstat_protocol_t[] statp = (perfstat_protocol_t[]) protocol.toArray(total... | 105 | 185 | 290 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/freebsd/Who.java | Who | queryUtxent | class Who {
private static final FreeBsdLibc LIBC = FreeBsdLibc.INSTANCE;
private Who() {
}
/**
* Query {@code getutxent} to get logged in users.
*
* @return A list of logged in user sessions
*/
public static synchronized List<OSSession> queryUtxent() {<FILL_FUNCTION_BODY>}
} |
List<OSSession> whoList = new ArrayList<>();
FreeBsdUtmpx ut;
// Rewind
LIBC.setutxent();
try {
// Iterate
while ((ut = LIBC.getutxent()) != null) {
if (ut.ut_type == USER_PROCESS || ut.ut_type == LOGIN_PROCESS) {
Strin... | 108 | 323 | 431 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/freebsd/disk/GeomDiskList.java | GeomDiskList | queryDisks | class GeomDiskList {
private static final String GEOM_DISK_LIST = "geom disk list";
private GeomDiskList() {
}
/**
* Queries disk data using geom
*
* @return A map with disk name as the key and a Triplet of model, serial, and size as the value
*/
public static Map<String, Trip... |
// Map of device name to disk, to be returned
Map<String, Triplet<String, String, Long>> diskMap = new HashMap<>();
// Parameters needed.
String diskName = null; // Non-null identifies a valid partition
String descr = Constants.UNKNOWN;
String ident = Constants.UNKNOWN;
... | 125 | 518 | 643 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/freebsd/disk/GeomPartList.java | GeomPartList | queryPartitions | class GeomPartList {
private static final String GEOM_PART_LIST = "geom part list";
private static final String STAT_FILESIZE = "stat -f %i /dev/";
private GeomPartList() {
}
/**
* Queries partition data using geom, mount, and stat commands
*
* @return A map with disk name as the k... |
Map<String, String> mountMap = Mount.queryPartitionToMountMap();
// Map of device name to partitions, to be returned
Map<String, List<HWPartition>> partitionMap = new HashMap<>();
// The Disk Store associated with a partition, key to the map
String diskName = null;
// Li... | 140 | 1,022 | 1,162 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/freebsd/disk/Mount.java | Mount | queryPartitionToMountMap | class Mount {
private static final String MOUNT_CMD = "mount";
private static final Pattern MOUNT_PATTERN = Pattern.compile("/dev/(\\S+p\\d+) on (\\S+) .*");
private Mount() {
}
/**
* Query mount to map partitions to mount points
*
* @return A map with partitions as the key and mou... |
// Parse 'mount' to map partitions to mount point
Map<String, String> mountMap = new HashMap<>();
for (String mnt : ExecutingCommand.runNative(MOUNT_CMD)) {
Matcher m = MOUNT_PATTERN.matcher(mnt);
if (m.matches()) {
mountMap.put(m.group(1), m.group(2));
... | 139 | 114 | 253 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/openbsd/disk/Disklabel.java | Disklabel | getDiskParams | class Disklabel {
private Disklabel() {
}
/**
* Gets disk and partition information
*
* @param diskName The disk to fetch partition information from
* @return A quartet containing the disk's name/label, DUID, size, and a list of partitions
*/
public static Quartet<String, Stri... |
// disklabel (requires root) supports 15 configurable partitions, `a' through
// `p', excluding `c'.
// The `c' partition describes the entire physical disk.
// By convention, the `a' partition of the boot disk is the root
// partition, and the `b' partition of the boot disk is ... | 582 | 1,365 | 1,947 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/solaris/Who.java | Who | queryUtxent | class Who {
private static final SolarisLibc LIBC = SolarisLibc.INSTANCE;
private Who() {
}
/**
* Query {@code getutxent} to get logged in users.
*
* @return A list of logged in user sessions
*/
public static synchronized List<OSSession> queryUtxent() {<FILL_FUNCTION_BODY>}
} |
List<OSSession> whoList = new ArrayList<>();
SolarisUtmpx ut;
// Rewind
LIBC.setutxent();
try {
// Iterate
while ((ut = LIBC.getutxent()) != null) {
if (ut.ut_type == USER_PROCESS || ut.ut_type == LOGIN_PROCESS) {
Strin... | 106 | 330 | 436 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/solaris/disk/Iostat.java | Iostat | queryDeviceStrings | class Iostat {
// Note uppercase E
private static final String IOSTAT_ER_DETAIL = "iostat -Er";
// Note lowercase e
private static final String IOSTAT_ER = "iostat -er";
// Sample output:
// errors
// device,s/w,h/w,trn,tot
// cmdk0,0,0,0,0
// sd0,0,0,0
// Note lowercase e
... |
Map<String, Quintet<String, String, String, String, Long>> deviceParamMap = new HashMap<>();
// Run iostat -Er to get model, etc.
List<String> iostat = ExecutingCommand.runNative(IOSTAT_ER_DETAIL);
// We'll use Model if available, otherwise Vendor+Product
String diskName = null;... | 705 | 680 | 1,385 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/solaris/disk/Lshal.java | Lshal | queryDiskToMajorMap | class Lshal {
private static final String LSHAL_CMD = "lshal";
private Lshal() {
}
/**
* Query lshal to get device major
*
* @return A map with disk names as the key and block device major as the value if lshal is installed; empty map
* otherwise
*/
public static ... |
Map<String, Integer> majorMap = new HashMap<>();
List<String> lshal = ExecutingCommand.runNative(LSHAL_CMD);
String diskName = null;
for (String line : lshal) {
if (line.startsWith("udi ")) {
String udi = ParseUtil.getSingleQuoteStringValue(line);
... | 119 | 186 | 305 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/solaris/disk/Prtvtoc.java | Prtvtoc | queryPartitions | class Prtvtoc {
private static final String PRTVTOC_DEV_DSK = "prtvtoc /dev/dsk/";
private Prtvtoc() {
}
public static List<HWPartition> queryPartitions(String mount, int major) {<FILL_FUNCTION_BODY>}
} |
List<HWPartition> partList = new ArrayList<>();
// This requires sudo permissions; will result in "permission denied"
// otherwise in which case we return empty partition list
List<String> prtvotc = ExecutingCommand.runNative(PRTVTOC_DEV_DSK + mount);
// Sample output - see man ... | 83 | 1,027 | 1,110 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/unix/solaris/kstat/SystemPages.java | SystemPages | queryAvailableTotal | class SystemPages {
private SystemPages() {
}
/**
* Queries the {@code system_pages} kstat and returns available and physical memory
*
* @return A pair with the available and total memory, in pages. Mutiply by page size for bytes.
*/
public static Pair<Long, Long> queryAvailableTot... |
if (HAS_KSTAT2) {
// Use Kstat2 implementation
return queryAvailableTotal2();
}
long memAvailable = 0;
long memTotal = 0;
// Get first result
try (KstatChain kc = KstatUtil.openChain()) {
Kstat ksp = kc.lookup(null, -1, "system_pages")... | 219 | 190 | 409 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/DeviceTree.java | DeviceTree | queryDeviceTree | class DeviceTree {
private static final int MAX_PATH = 260;
private static final SetupApi SA = SetupApi.INSTANCE;
private static final Cfgmgr32 C32 = Cfgmgr32.INSTANCE;
private DeviceTree() {
}
/**
* Queries devices matching the specified device interface and returns maps representing de... |
Map<Integer, Integer> parentMap = new HashMap<>();
Map<Integer, String> nameMap = new HashMap<>();
Map<Integer, String> deviceIdMap = new HashMap<>();
Map<Integer, String> mfgMap = new HashMap<>();
// Get device IDs for the top level devices
HANDLE hDevInfo = SA.SetupDiG... | 446 | 898 | 1,344 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/EnumWindows.java | EnumWindows | queryDesktopWindows | class EnumWindows {
private static final DWORD GW_HWNDNEXT = new DWORD(2);
private EnumWindows() {
}
/**
* Gets windows on the operating system's GUI desktop.
*
* @param visibleOnly Whether to restrict the list to only windows visible to the user.
* @return A list of {@link oshi.s... |
// Get the windows using JNA's implementation
List<DesktopWindow> windows = WindowUtils.getAllWindows(true);
// Prepare a list to return
List<OSDesktopWindow> windowList = new ArrayList<>();
// Populate the list
Map<HWND, Integer> zOrderMap = new HashMap<>();
for... | 323 | 313 | 636 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/perfmon/LoadAverage.java | LoadAverage | startDaemon | class LoadAverage {
// Daemon thread for Load Average
private static Thread loadAvgThread = null;
private static double[] loadAverages = new double[] { -1d, -1d, -1d };
private static final double[] EXP_WEIGHT = new double[] {
// 1-, 5-, and 15-minute exponential smoothing weight
... |
if (loadAvgThread != null) {
return;
}
loadAvgThread = new Thread("OSHI Load Average daemon") {
@Override
public void run() {
// Initialize tick counters
Pair<Long, Long> nonIdlePair = LoadAverage.queryNonIdleTicks();
... | 587 | 754 | 1,341 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/perfmon/MemoryInformation.java | MemoryInformation | queryPageSwaps | class MemoryInformation {
/**
* For pages in/out
*/
public enum PageSwapProperty implements PdhCounterProperty {
PAGESINPUTPERSEC(null, "Pages Input/sec"), //
PAGESOUTPUTPERSEC(null, "Pages Output/sec");
private final String instance;
private final String counter;
... |
if (PerfmonDisabled.PERF_OS_DISABLED) {
return Collections.emptyMap();
}
return PerfCounterQuery.queryValues(PageSwapProperty.class, MEMORY, WIN32_PERF_RAW_DATA_PERF_OS_MEMORY);
| 241 | 78 | 319 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/perfmon/PagingFile.java | PagingFile | querySwapUsed | class PagingFile {
/**
* For swap file usage
*/
public enum PagingPercentProperty implements PdhCounterProperty {
PERCENTUSAGE(PerfCounterQuery.TOTAL_INSTANCE, "% Usage");
private final String instance;
private final String counter;
PagingPercentProperty(String insta... |
if (PerfmonDisabled.PERF_OS_DISABLED) {
return Collections.emptyMap();
}
return PerfCounterQuery.queryValues(PagingPercentProperty.class, PAGING_FILE,
WIN32_PERF_RAW_DATA_PERF_OS_PAGING_FILE);
| 232 | 86 | 318 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/perfmon/PerfmonDisabled.java | PerfmonDisabled | isDisabled | class PerfmonDisabled {
private static final Logger LOG = LoggerFactory.getLogger(PerfmonDisabled.class);
public static final boolean PERF_OS_DISABLED = isDisabled(GlobalConfig.OSHI_OS_WINDOWS_PERFOS_DIABLED, "PerfOS");
public static final boolean PERF_PROC_DISABLED = isDisabled(GlobalConfig.OSHI_OS_WINDO... |
String perfDisabled = GlobalConfig.get(config);
// If null or empty, check registry
if (Util.isBlank(perfDisabled)) {
String key = String.format(Locale.ROOT, "SYSTEM\\CurrentControlSet\\Services\\%s\\Performance", service);
String value = "Disable Performance Counters";
... | 251 | 344 | 595 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/perfmon/PhysicalDisk.java | PhysicalDisk | queryDiskCounters | class PhysicalDisk {
/**
* Physical Disk performance counters.
*/
public enum PhysicalDiskProperty implements PdhCounterWildcardProperty {
// First element defines WMI instance name field and PDH instance filter
NAME(PerfCounterQuery.NOT_TOTAL_INSTANCE),
// Remaining elements ... |
if (PerfmonDisabled.PERF_DISK_DISABLED) {
return new Pair<>(Collections.emptyList(), Collections.emptyMap());
}
return PerfCounterWildcardQuery.queryInstancesAndValues(PhysicalDiskProperty.class, PHYSICAL_DISK,
WIN32_PERF_RAW_DATA_PERF_DISK_PHYSICAL_DISK_WHERE_NAME_N... | 331 | 115 | 446 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/perfmon/ProcessInformation.java | ProcessInformation | queryHandles | class ProcessInformation {
/**
* Process performance counters
*/
public enum ProcessPerformanceProperty implements PdhCounterWildcardProperty {
// First element defines WMI instance name field and PDH instance filter
NAME(PerfCounterQuery.NOT_TOTAL_INSTANCES),
// Remaining ele... |
if (PerfmonDisabled.PERF_PROC_DISABLED) {
return new Pair<>(Collections.emptyList(), Collections.emptyMap());
}
return PerfCounterWildcardQuery.queryInstancesAndValues(HandleCountProperty.class, PROCESS,
WIN32_PERFPROC_PROCESS);
| 967 | 87 | 1,054 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/perfmon/ProcessorInformation.java | ProcessorInformation | queryInterruptCounters | class ProcessorInformation {
private static final boolean IS_WIN7_OR_GREATER = VersionHelpers.IsWindows7OrGreater();
/**
* Processor performance counters
*/
public enum ProcessorTickCountProperty implements PdhCounterWildcardProperty {
// First element defines WMI instance name field and... |
if (PerfmonDisabled.PERF_OS_DISABLED) {
return Collections.emptyMap();
}
return PerfCounterQuery.queryValues(InterruptsProperty.class, PROCESSOR,
WIN32_PERF_RAW_DATA_PERF_OS_PROCESSOR_WHERE_NAME_TOTAL);
| 1,607 | 89 | 1,696 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/perfmon/SystemInformation.java | SystemInformation | queryProcessorQueueLength | class SystemInformation {
/**
* Context switch property
*/
public enum ContextSwitchProperty implements PdhCounterProperty {
CONTEXTSWITCHESPERSEC(null, "Context Switches/sec");
private final String instance;
private final String counter;
ContextSwitchProperty(String... |
if (PerfmonDisabled.PERF_OS_DISABLED) {
return Collections.emptyMap();
}
return PerfCounterQuery.queryValues(ProcessorQueueLengthProperty.class, SYSTEM,
WIN32_PERF_RAW_DATA_PERF_OS_SYSTEM);
| 498 | 79 | 577 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/perfmon/ThreadInformation.java | ThreadInformation | queryThreadCounters | class ThreadInformation {
/**
* Thread performance counters
*/
public enum ThreadPerformanceProperty implements PdhCounterWildcardProperty {
// First element defines WMI instance name field and PDH instance filter
NAME(PerfCounterQuery.NOT_TOTAL_INSTANCES),
// Remaining elemen... |
String procName = name.toLowerCase(Locale.ROOT);
if (threadNum >= 0) {
return PerfCounterWildcardQuery.queryInstancesAndValues(
ThreadPerformanceProperty.class, THREAD, WIN32_PERF_RAW_DATA_PERF_PROC_THREAD
+ " WHERE Name LIKE \\\"" + procName ... | 540 | 195 | 735 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/registry/HkeyUserData.java | HkeyUserData | queryUserSessions | class HkeyUserData {
private static final String PATH_DELIMITER = "\\";
private static final String DEFAULT_DEVICE = "Console";
private static final String VOLATILE_ENV_SUBKEY = "Volatile Environment";
private static final String CLIENTNAME = "CLIENTNAME";
private static final String SESSIONNAME = ... |
List<OSSession> sessions = new ArrayList<>();
for (String sidKey : Advapi32Util.registryGetKeys(WinReg.HKEY_USERS)) {
if (!sidKey.startsWith(".") && !sidKey.endsWith("_Classes")) {
try {
Account a = Advapi32Util.getAccountBySid(sidKey);
... | 156 | 618 | 774 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/registry/NetSessionData.java | NetSessionData | queryUserSessions | class NetSessionData {
private static final Netapi32 NET = Netapi32.INSTANCE;
private NetSessionData() {
}
public static List<OSSession> queryUserSessions() {<FILL_FUNCTION_BODY>}
} |
List<OSSession> sessions = new ArrayList<>();
try (CloseablePointerByReference bufptr = new CloseablePointerByReference();
CloseableIntByReference entriesread = new CloseableIntByReference();
CloseableIntByReference totalentries = new CloseableIntByReference()) {
... | 70 | 331 | 401 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/registry/ProcessWtsData.java | ProcessWtsData | queryProcessWtsMapFromWTS | class ProcessWtsData {
private static final Logger LOG = LoggerFactory.getLogger(ProcessWtsData.class);
private static final boolean IS_WINDOWS7_OR_GREATER = VersionHelpers.IsWindows7OrGreater();
private ProcessWtsData() {
}
/**
* Query the registry for process performance counters
*
... |
Map<Integer, WtsInfo> wtsMap = new HashMap<>();
try (CloseableIntByReference pCount = new CloseableIntByReference(0);
CloseablePointerByReference ppProcessInfo = new CloseablePointerByReference();
CloseableIntByReference infoLevel1 = new CloseableIntByReference(Wtsapi32.... | 1,144 | 536 | 1,680 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/registry/SessionWtsData.java | SessionWtsData | queryUserSessions | class SessionWtsData {
private static final int WTS_ACTIVE = 0;
private static final int WTS_CLIENTADDRESS = 14;
private static final int WTS_SESSIONINFO = 24;
private static final int WTS_CLIENTPROTOCOLTYPE = 16;
private static final boolean IS_VISTA_OR_GREATER = VersionHelpers.IsWindowsVistaOrGr... |
List<OSSession> sessions = new ArrayList<>();
if (IS_VISTA_OR_GREATER) {
try (CloseablePointerByReference ppSessionInfo = new CloseablePointerByReference();
CloseableIntByReference pCount = new CloseableIntByReference();
CloseablePointerByReference pp... | 418 | 974 | 1,392 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/MSAcpiThermalZoneTemperature.java | MSAcpiThermalZoneTemperature | queryCurrentTemperature | class MSAcpiThermalZoneTemperature {
public static final String WMI_NAMESPACE = "ROOT\\WMI";
private static final String MS_ACPI_THERMAL_ZONE_TEMPERATURE = "MSAcpi_ThermalZoneTemperature";
/**
* Current temperature property.
*/
public enum TemperatureProperty {
CURRENTTEMPERATURE;
... |
WmiQuery<TemperatureProperty> curTempQuery = new WmiQuery<>(WMI_NAMESPACE, MS_ACPI_THERMAL_ZONE_TEMPERATURE,
TemperatureProperty.class);
return Objects.requireNonNull(WmiQueryHandler.createInstance()).queryWMI(curTempQuery);
| 194 | 82 | 276 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/MSFTStorage.java | MSFTStorage | queryPhysicalDisks | class MSFTStorage {
private static final String STORAGE_NAMESPACE = "ROOT\\Microsoft\\Windows\\Storage";
private static final String MSFT_STORAGE_POOL_WHERE_IS_PRIMORDIAL_FALSE = "MSFT_StoragePool WHERE IsPrimordial=FALSE";
private static final String MSFT_STORAGE_POOL_TO_PHYSICAL_DISK = "MSFT_StoragePoolT... |
WmiQuery<PhysicalDiskProperty> physicalDiskQuery = new WmiQuery<>(STORAGE_NAMESPACE, MSFT_PHYSICAL_DISK,
PhysicalDiskProperty.class);
return h.queryWMI(physicalDiskQuery, false);
| 994 | 66 | 1,060 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/OhmHardware.java | OhmHardware | queryHwIdentifier | class OhmHardware {
private static final String HARDWARE = "Hardware";
/**
* HW Identifier Property
*/
public enum IdentifierProperty {
IDENTIFIER;
}
private OhmHardware() {
}
/**
* Queries the hardware identifiers for a monitored type.
*
* @param h ... |
StringBuilder sb = new StringBuilder(HARDWARE);
sb.append(" WHERE ").append(typeToQuery).append("Type=\"").append(typeName).append('\"');
WmiQuery<IdentifierProperty> cpuIdentifierQuery = new WmiQuery<>(WmiUtil.OHM_NAMESPACE, sb.toString(),
IdentifierProperty.class);
ret... | 203 | 108 | 311 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/OhmSensor.java | OhmSensor | querySensorValue | class OhmSensor {
private static final String SENSOR = "Sensor";
/**
* Sensor value property
*/
public enum ValueProperty {
VALUE;
}
private OhmSensor() {
}
/**
* Queries the sensor value of an hardware identifier and sensor type.
*
* @param h An... |
StringBuilder sb = new StringBuilder(SENSOR);
sb.append(" WHERE Parent = \"").append(identifier);
sb.append("\" AND SensorType=\"").append(sensorType).append('\"');
WmiQuery<ValueProperty> ohmSensorQuery = new WmiQuery<>(WmiUtil.OHM_NAMESPACE, sb.toString(),
ValuePropert... | 194 | 119 | 313 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/Win32DiskDrive.java | Win32DiskDrive | queryDiskDrive | class Win32DiskDrive {
private static final String WIN32_DISK_DRIVE = "Win32_DiskDrive";
/**
* Disk drive properties
*/
public enum DiskDriveProperty {
INDEX, MANUFACTURER, MODEL, NAME, SERIALNUMBER, SIZE;
}
private Win32DiskDrive() {
}
/**
* Queries the disk drive... |
WmiQuery<DiskDriveProperty> diskDriveQuery = new WmiQuery<>(WIN32_DISK_DRIVE, DiskDriveProperty.class);
return h.queryWMI(diskDriveQuery, false);
| 193 | 58 | 251 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/Win32DiskDriveToDiskPartition.java | Win32DiskDriveToDiskPartition | queryDriveToPartition | class Win32DiskDriveToDiskPartition {
private static final String WIN32_DISK_DRIVE_TO_DISK_PARTITION = "Win32_DiskDriveToDiskPartition";
/**
* Links disk drives to partitions
*/
public enum DriveToPartitionProperty {
ANTECEDENT, DEPENDENT;
}
private Win32DiskDriveToDiskPartition... |
WmiQuery<DriveToPartitionProperty> driveToPartitionQuery = new WmiQuery<>(WIN32_DISK_DRIVE_TO_DISK_PARTITION,
DriveToPartitionProperty.class);
return h.queryWMI(driveToPartitionQuery, false);
| 213 | 69 | 282 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/Win32DiskPartition.java | Win32DiskPartition | queryPartition | class Win32DiskPartition {
private static final String WIN32_DISK_PARTITION = "Win32_DiskPartition";
/**
* Disk partition properties
*/
public enum DiskPartitionProperty {
INDEX, DESCRIPTION, DEVICEID, DISKINDEX, NAME, SIZE, TYPE;
}
private Win32DiskPartition() {
}
/**
... |
WmiQuery<DiskPartitionProperty> partitionQuery = new WmiQuery<>(WIN32_DISK_PARTITION,
DiskPartitionProperty.class);
return h.queryWMI(partitionQuery, false);
| 183 | 54 | 237 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/Win32LogicalDisk.java | Win32LogicalDisk | queryLogicalDisk | class Win32LogicalDisk {
private static final String WIN32_LOGICAL_DISK = "Win32_LogicalDisk";
/**
* Logical disk properties.
*/
public enum LogicalDiskProperty {
ACCESS, DESCRIPTION, DRIVETYPE, FILESYSTEM, FREESPACE, NAME, PROVIDERNAME, SIZE, VOLUMENAME;
}
private Win32LogicalD... |
StringBuilder wmiClassName = new StringBuilder(WIN32_LOGICAL_DISK);
boolean where = false;
if (localOnly) {
wmiClassName.append(" WHERE DriveType != 4");
where = true;
}
if (nameToMatch != null) {
wmiClassName.append(where ? " AND" : " WHERE")... | 218 | 180 | 398 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/Win32LogicalDiskToPartition.java | Win32LogicalDiskToPartition | queryDiskToPartition | class Win32LogicalDiskToPartition {
private static final String WIN32_LOGICAL_DISK_TO_PARTITION = "Win32_LogicalDiskToPartition";
/**
* Links disk drives to partitions
*/
public enum DiskToPartitionProperty {
ANTECEDENT, DEPENDENT, ENDINGADDRESS, STARTINGADDRESS;
}
private Win32... |
WmiQuery<DiskToPartitionProperty> diskToPartitionQuery = new WmiQuery<>(WIN32_LOGICAL_DISK_TO_PARTITION,
DiskToPartitionProperty.class);
return h.queryWMI(diskToPartitionQuery, false);
| 215 | 65 | 280 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/Win32Process.java | Win32Process | queryProcesses | class Win32Process {
private static final String WIN32_PROCESS = "Win32_Process";
/**
* Process command lines.
*/
public enum CommandLineProperty {
PROCESSID, COMMANDLINE;
}
/**
* Process properties accessible from WTSEnumerateProcesses in Vista+
*/
public enum Pro... |
String sb = WIN32_PROCESS;
if (pids != null) {
sb += " WHERE ProcessID="
+ pids.stream().map(String::valueOf).collect(Collectors.joining(" OR PROCESSID="));
}
WmiQuery<ProcessXPProperty> processQueryXP = new WmiQuery<>(sb, ProcessXPProperty.class);
... | 462 | 127 | 589 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/driver/windows/wmi/Win32ProcessCached.java | Win32ProcessCached | getCommandLine | class Win32ProcessCached {
private static final Supplier<Win32ProcessCached> INSTANCE = memoize(Win32ProcessCached::createInstance);
// Use a map to cache command line queries
@GuardedBy("commandLineCacheLock")
private final Map<Integer, Pair<Long, String>> commandLineCache = new HashMap<>();
priv... |
// We could use synchronized method but this is more clear
commandLineCacheLock.lock();
try {
// See if this process is in the cache already
Pair<Long, String> pair = commandLineCache.get(processId);
// Valid process must have been started before map insertio... | 557 | 431 | 988 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/HWPartition.java | HWPartition | toString | class HWPartition {
private final String identification;
private final String name;
private final String type;
private final String uuid;
private final long size;
private final int major;
private final int minor;
private final String mountPoint;
/**
* Creates a new HWPartition... |
StringBuilder sb = new StringBuilder();
sb.append(getIdentification()).append(": ");
sb.append(getName()).append(" ");
sb.append("(").append(getType()).append(") ");
sb.append("Maj:Min=").append(getMajor()).append(":").append(getMinor()).append(", ");
sb.append("size: ")... | 869 | 140 | 1,009 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/PhysicalMemory.java | PhysicalMemory | toString | class PhysicalMemory {
private final String bankLabel;
private final long capacity;
private final long clockSpeed;
private final String manufacturer;
private final String memoryType;
private final String partNumber;
public PhysicalMemory(String bankLabel, long capacity, long clockSpeed, St... |
StringBuilder sb = new StringBuilder();
sb.append("Bank label: " + getBankLabel());
sb.append(", Capacity: " + FormatUtil.formatBytes(getCapacity()));
sb.append(", Clock speed: " + FormatUtil.formatHertz(getClockSpeed()));
sb.append(", Manufacturer: " + getManufacturer());
... | 496 | 134 | 630 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractBaseboard.java | AbstractBaseboard | toString | class AbstractBaseboard implements Baseboard {
@Override
public String toString() {<FILL_FUNCTION_BODY>}
} |
StringBuilder sb = new StringBuilder();
sb.append("manufacturer=").append(getManufacturer()).append(", ");
sb.append("model=").append(getModel()).append(", ");
sb.append("version=").append(getVersion()).append(", ");
sb.append("serial number=").append(getSerialNumber());
... | 37 | 94 | 131 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractComputerSystem.java | AbstractComputerSystem | toString | class AbstractComputerSystem implements ComputerSystem {
private final Supplier<Firmware> firmware = memoize(this::createFirmware);
private final Supplier<Baseboard> baseboard = memoize(this::createBaseboard);
@Override
public Firmware getFirmware() {
return firmware.get();
}
/**
... |
StringBuilder sb = new StringBuilder();
sb.append("manufacturer=").append(getManufacturer()).append(", ");
sb.append("model=").append(getModel()).append(", ");
sb.append("serial number=").append(getSerialNumber()).append(", ");
sb.append("uuid=").append(getHardwareUUID());
... | 243 | 96 | 339 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractFirmware.java | AbstractFirmware | toString | class AbstractFirmware implements Firmware {
/*
* Multiple classes don't have these, set defaults here
*/
@Override
public String getName() {
return Constants.UNKNOWN;
}
@Override
public String getDescription() {
return Constants.UNKNOWN;
}
@Override
pub... |
StringBuilder sb = new StringBuilder();
sb.append("manufacturer=").append(getManufacturer()).append(", ");
sb.append("name=").append(getName()).append(", ");
sb.append("description=").append(getDescription()).append(", ");
sb.append("version=").append(getVersion()).append(", ");... | 143 | 122 | 265 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractGlobalMemory.java | AbstractGlobalMemory | getPhysicalMemory | class AbstractGlobalMemory implements GlobalMemory {
@Override
public List<PhysicalMemory> getPhysicalMemory() {<FILL_FUNCTION_BODY>}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Available: ");
sb.append(FormatUtil.formatBytes(getAvail... |
// dmidecode requires sudo permission but is the only option on Linux
// and Unix
List<PhysicalMemory> pmList = new ArrayList<>();
List<String> dmi = ExecutingCommand.runNative("dmidecode --type 17");
int bank = 0;
String bankLabel = Constants.UNKNOWN;
String loc... | 122 | 569 | 691 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractGraphicsCard.java | AbstractGraphicsCard | toString | class AbstractGraphicsCard implements GraphicsCard {
private final String name;
private final String deviceId;
private final String vendor;
private final String versionInfo;
private long vram;
/**
* Constructor for AbstractGraphicsCard
*
* @param name The name
* @par... |
StringBuilder builder = new StringBuilder();
builder.append("GraphicsCard@");
builder.append(Integer.toHexString(hashCode()));
builder.append(" [name=");
builder.append(this.name);
builder.append(", deviceId=");
builder.append(this.deviceId);
builder.appe... | 331 | 162 | 493 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractHWDiskStore.java | AbstractHWDiskStore | toString | class AbstractHWDiskStore implements HWDiskStore {
private final String name;
private final String model;
private final String serial;
private final long size;
protected AbstractHWDiskStore(String name, String model, String serial, long size) {
this.name = name;
this.model = model;... |
boolean readwrite = getReads() > 0 || getWrites() > 0;
StringBuilder sb = new StringBuilder();
sb.append(getName()).append(": ");
sb.append("(model: ").append(getModel());
sb.append(" - S/N: ").append(getSerial()).append(") ");
sb.append("size: ").append(getSize() > 0 ? ... | 219 | 262 | 481 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractLogicalVolumeGroup.java | AbstractLogicalVolumeGroup | toString | class AbstractLogicalVolumeGroup implements LogicalVolumeGroup {
private final String name;
private final Map<String, Set<String>> lvMap;
private final Set<String> pvSet;
/**
* @param name Name of the volume group
* @param lvMap Logical volumes derived from this volume group and the physica... |
StringBuilder sb = new StringBuilder("Logical Volume Group: ");
sb.append(name).append("\n |-- PVs: ");
sb.append(pvSet.toString());
for (Entry<String, Set<String>> entry : lvMap.entrySet()) {
sb.append("\n |-- LV: ").append(entry.getKey());
Set<String> mappedPVs... | 352 | 147 | 499 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractSensors.java | AbstractSensors | toString | class AbstractSensors implements Sensors {
private final Supplier<Double> cpuTemperature = memoize(this::queryCpuTemperature, defaultExpiration());
private final Supplier<int[]> fanSpeeds = memoize(this::queryFanSpeeds, defaultExpiration());
private final Supplier<Double> cpuVoltage = memoize(this::query... |
StringBuilder sb = new StringBuilder();
sb.append("CPU Temperature=").append(getCpuTemperature()).append("C, ");
sb.append("Fan Speeds=").append(Arrays.toString(getFanSpeeds())).append(", ");
sb.append("CPU Voltage=").append(getCpuVoltage());
return sb.toString();
| 255 | 93 | 348 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractSoundCard.java | AbstractSoundCard | toString | class AbstractSoundCard implements SoundCard {
private String kernelVersion;
private String name;
private String codec;
/**
* Abstract Sound Card Constructor
*
* @param kernelVersion The version
* @param name The name
* @param codec The codec
*/
prote... |
StringBuilder builder = new StringBuilder();
builder.append("SoundCard@");
builder.append(Integer.toHexString(hashCode()));
builder.append(" [name=");
builder.append(this.name);
builder.append(", kernelVersion=");
builder.append(this.kernelVersion);
build... | 226 | 117 | 343 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractUsbDevice.java | AbstractUsbDevice | indentUsb | class AbstractUsbDevice implements UsbDevice {
private final String name;
private final String vendor;
private final String vendorId;
private final String productId;
private final String serialNumber;
private final String uniqueDeviceId;
private final List<UsbDevice> connectedDevices;
... |
String indentFmt = indent > 4 ? String.format(Locale.ROOT, "%%%ds|-- ", indent - 4)
: String.format(Locale.ROOT, "%%%ds", indent);
StringBuilder sb = new StringBuilder(String.format(Locale.ROOT, indentFmt, ""));
sb.append(usbDevice.getName());
if (!usbDevice.getVendor().... | 552 | 230 | 782 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/common/AbstractVirtualMemory.java | AbstractVirtualMemory | toString | class AbstractVirtualMemory implements VirtualMemory {
@Override
public String toString() {<FILL_FUNCTION_BODY>}
} |
StringBuilder sb = new StringBuilder();
sb.append("Swap Used/Avail: ");
sb.append(FormatUtil.formatBytes(getSwapUsed()));
sb.append("/");
sb.append(FormatUtil.formatBytes(getSwapTotal()));
sb.append(", Virtual Memory In Use/Max=");
sb.append(FormatUtil.formatByte... | 36 | 130 | 166 | <no_super_class> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxBaseboard.java | LinuxBaseboard | queryManufacturer | class LinuxBaseboard extends AbstractBaseboard {
private final Supplier<String> manufacturer = memoize(this::queryManufacturer);
private final Supplier<String> model = memoize(this::queryModel);
private final Supplier<String> version = memoize(this::queryVersion);
private final Supplier<String> serialN... |
String result = null;
if ((result = Sysfs.queryBoardVendor()) == null
&& (result = manufacturerModelVersionSerial.get().getA()) == null) {
return Constants.UNKNOWN;
}
return result;
| 481 | 67 | 548 | <methods>public non-sealed void <init>() ,public java.lang.String toString() <variables> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxComputerSystem.java | LinuxComputerSystem | queryManufacturer | class LinuxComputerSystem extends AbstractComputerSystem {
private final Supplier<String> manufacturer = memoize(LinuxComputerSystem::queryManufacturer);
private final Supplier<String> model = memoize(LinuxComputerSystem::queryModel);
private final Supplier<String> serialNumber = memoize(LinuxComputerSys... |
String result = null;
if ((result = Sysfs.querySystemVendor()) == null && (result = CpuInfo.queryCpuManufacturer()) == null) {
return Constants.UNKNOWN;
}
return result;
| 578 | 65 | 643 | <methods>public non-sealed void <init>() ,public oshi.hardware.Baseboard getBaseboard() ,public oshi.hardware.Firmware getFirmware() ,public java.lang.String toString() <variables>private final Supplier<oshi.hardware.Baseboard> baseboard,private final Supplier<oshi.hardware.Firmware> firmware |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxFirmware.java | LinuxFirmware | queryVersion | class LinuxFirmware extends AbstractFirmware {
// Jan 13 2013 16:24:29
private static final DateTimeFormatter VCGEN_FORMATTER = DateTimeFormatter.ofPattern("MMM d uuuu HH:mm:ss",
Locale.ENGLISH);
private final Supplier<String> manufacturer = memoize(this::queryManufacturer);
private final ... |
String result = null;
if ((result = Sysfs.queryBiosVersion(this.biosNameRev.get().getB())) == null
&& (result = vcGenCmd.get().version) == null) {
return Constants.UNKNOWN;
}
return result;
| 1,129 | 77 | 1,206 | <methods>public non-sealed void <init>() ,public java.lang.String getDescription() ,public java.lang.String getName() ,public java.lang.String getReleaseDate() ,public java.lang.String toString() <variables> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxGlobalMemory.java | LinuxGlobalMemory | readMemInfo | class LinuxGlobalMemory extends AbstractGlobalMemory {
private static final long PAGE_SIZE = LinuxOperatingSystem.getPageSize();
private final Supplier<Pair<Long, Long>> availTotal = memoize(LinuxGlobalMemory::readMemInfo, defaultExpiration());
private final Supplier<VirtualMemory> vm = memoize(this::cre... |
long memFree = 0L;
long activeFile = 0L;
long inactiveFile = 0L;
long sReclaimable = 0L;
long memTotal = 0L;
long memAvailable;
List<String> procMemInfo = FileUtil.readFile(ProcPath.MEMINFO);
for (String checkLine : procMemInfo) {
String[] m... | 456 | 437 | 893 | <methods>public non-sealed void <init>() ,public List<oshi.hardware.PhysicalMemory> getPhysicalMemory() ,public java.lang.String toString() <variables> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxGraphicsCard.java | LinuxGraphicsCard | getGraphicsCardsFromLshw | class LinuxGraphicsCard extends AbstractGraphicsCard {
/**
* Constructor for LinuxGraphicsCard
*
* @param name The name
* @param deviceId The device ID
* @param vendor The vendor
* @param versionInfo The version info
* @param vram The VRAM
*/
LinuxG... |
List<GraphicsCard> cardList = new ArrayList<>();
List<String> lshw = ExecutingCommand.runNative("lshw -C display");
String name = Constants.UNKNOWN;
String deviceId = Constants.UNKNOWN;
String vendor = Constants.UNKNOWN;
List<String> versionInfoList = new ArrayList<>();
... | 1,100 | 423 | 1,523 | <methods>public java.lang.String getDeviceId() ,public java.lang.String getName() ,public long getVRam() ,public java.lang.String getVendor() ,public java.lang.String getVersionInfo() ,public java.lang.String toString() <variables>private final non-sealed java.lang.String deviceId,private final non-sealed java.lang.Str... |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxLogicalVolumeGroup.java | LinuxLogicalVolumeGroup | getLogicalVolumeGroups | class LinuxLogicalVolumeGroup extends AbstractLogicalVolumeGroup {
private static final Logger LOG = LoggerFactory.getLogger(LinuxLogicalVolumeGroup.class);
private static final String BLOCK = "block";
private static final String DM_UUID = "DM_UUID";
private static final String DM_VG_NAME = "DM_VG_NAM... |
if (!HAS_UDEV) {
LOG.warn("Logical Volume Group information requires libudev, which is not present.");
return Collections.emptyList();
}
Map<String, Map<String, Set<String>>> logicalVolumesMap = new HashMap<>();
Map<String, Set<String>> physicalVolumesMap = new H... | 189 | 927 | 1,116 | <methods>public Map<java.lang.String,Set<java.lang.String>> getLogicalVolumes() ,public java.lang.String getName() ,public Set<java.lang.String> getPhysicalVolumes() ,public java.lang.String toString() <variables>private final non-sealed Map<java.lang.String,Set<java.lang.String>> lvMap,private final non-sealed java.la... |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxNetworkIF.java | LinuxNetworkIF | updateAttributes | class LinuxNetworkIF extends AbstractNetworkIF {
private static final Logger LOG = LoggerFactory.getLogger(LinuxNetworkIF.class);
private int ifType;
private boolean connectorPresent;
private long bytesRecv;
private long bytesSent;
private long packetsRecv;
private long packetsSent;
pr... |
String name = SysPath.NET + getName();
try {
File ifDir = new File(name + "/statistics");
if (!ifDir.isDirectory()) {
return false;
}
} catch (SecurityException e) {
return false;
}
this.timeStamp = System.currentT... | 1,350 | 474 | 1,824 | <methods>public java.lang.String getDisplayName() ,public java.lang.String[] getIPv4addr() ,public java.lang.String[] getIPv6addr() ,public int getIndex() ,public long getMTU() ,public java.lang.String getMacaddr() ,public java.lang.String getName() ,public java.lang.Short[] getPrefixLengths() ,public java.lang.Short[]... |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxSoundCard.java | LinuxSoundCard | getCardFolders | class LinuxSoundCard extends AbstractSoundCard {
private static final Logger LOG = LoggerFactory.getLogger(LinuxSoundCard.class);
private static final String CARD_FOLDER = "card";
private static final String CARDS_FILE = "cards";
private static final String ID_FILE = "id";
/**
* Constructor ... |
File cardsDirectory = new File(ProcPath.ASOUND);
List<File> cardFolders = new ArrayList<>();
File[] allContents = cardsDirectory.listFiles();
if (allContents != null) {
for (File card : allContents) {
if (card.getName().startsWith(CARD_FOLDER) && card.isDirec... | 1,244 | 141 | 1,385 | <methods>public java.lang.String getCodec() ,public java.lang.String getDriverVersion() ,public java.lang.String getName() ,public java.lang.String toString() <variables>private java.lang.String codec,private java.lang.String kernelVersion,private java.lang.String name |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/linux/LinuxVirtualMemory.java | LinuxVirtualMemory | queryVmStat | class LinuxVirtualMemory extends AbstractVirtualMemory {
private final LinuxGlobalMemory global;
private final Supplier<Triplet<Long, Long, Long>> usedTotalCommitLim = memoize(LinuxVirtualMemory::queryMemInfo,
defaultExpiration());
private final Supplier<Pair<Long, Long>> inOut = memoize(Linu... |
long swapPagesIn = 0L;
long swapPagesOut = 0L;
List<String> procVmStat = FileUtil.readFile(ProcPath.VMSTAT);
for (String checkLine : procVmStat) {
String[] memorySplit = ParseUtil.whitespaces.split(checkLine);
if (memorySplit.length > 1) {
switch ... | 813 | 216 | 1,029 | <methods>public non-sealed void <init>() ,public java.lang.String toString() <variables> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/mac/MacBaseboard.java | MacBaseboard | queryPlatform | class MacBaseboard extends AbstractBaseboard {
private final Supplier<Quartet<String, String, String, String>> manufModelVersSerial = memoize(
MacBaseboard::queryPlatform);
@Override
public String getManufacturer() {
return manufModelVersSerial.get().getA();
}
@Override
pu... |
String manufacturer = null;
String model = null;
String version = null;
String serialNumber = null;
IORegistryEntry platformExpert = IOKitUtil.getMatchingService("IOPlatformExpertDevice");
if (platformExpert != null) {
byte[] data = platformExpert.getByteArr... | 206 | 466 | 672 | <methods>public non-sealed void <init>() ,public java.lang.String toString() <variables> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/mac/MacComputerSystem.java | MacComputerSystem | platformExpert | class MacComputerSystem extends AbstractComputerSystem {
private final Supplier<Quartet<String, String, String, String>> manufacturerModelSerialUUID = memoize(
MacComputerSystem::platformExpert);
@Override
public String getManufacturer() {
return manufacturerModelSerialUUID.get().getA(... |
String manufacturer = null;
String model = null;
String serialNumber = null;
String uuid = null;
IORegistryEntry platformExpert = IOKitUtil.getMatchingService("IOPlatformExpertDevice");
if (platformExpert != null) {
byte[] data = platformExpert.getByteArrayPr... | 263 | 304 | 567 | <methods>public non-sealed void <init>() ,public oshi.hardware.Baseboard getBaseboard() ,public oshi.hardware.Firmware getFirmware() ,public java.lang.String toString() <variables>private final Supplier<oshi.hardware.Baseboard> baseboard,private final Supplier<oshi.hardware.Firmware> firmware |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/mac/MacDisplay.java | MacDisplay | getDisplays | class MacDisplay extends AbstractDisplay {
private static final Logger LOG = LoggerFactory.getLogger(MacDisplay.class);
/**
* Constructor for MacDisplay.
*
* @param edid a byte array representing a display EDID
*/
MacDisplay(byte[] edid) {
super(edid);
LOG.debug("Initia... |
List<Display> displays = new ArrayList<>();
// Iterate IO Registry IODisplayConnect
IOIterator serviceIterator = IOKitUtil.getMatchingServices("IODisplayConnect");
if (serviceIterator != null) {
CFStringRef cfEdid = CFStringRef.createCFString("IODisplayEDID");
IO... | 155 | 342 | 497 | <methods>public byte[] getEdid() ,public java.lang.String toString() <variables>private final non-sealed byte[] edid |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/mac/MacFirmware.java | MacFirmware | queryEfi | class MacFirmware extends AbstractFirmware {
private final Supplier<Quintet<String, String, String, String, String>> manufNameDescVersRelease = memoize(
MacFirmware::queryEfi);
@Override
public String getManufacturer() {
return manufNameDescVersRelease.get().getA();
}
@Overrid... |
String manufacturer = null;
String name = null;
String description = null;
String version = null;
String releaseDate = null;
IORegistryEntry platformExpert = IOKitUtil.getMatchingService("IOPlatformExpertDevice");
byte[] data;
if (platformExpert != null)... | 252 | 794 | 1,046 | <methods>public non-sealed void <init>() ,public java.lang.String getDescription() ,public java.lang.String getName() ,public java.lang.String getReleaseDate() ,public java.lang.String toString() <variables> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/mac/MacGlobalMemory.java | MacGlobalMemory | queryPageSize | class MacGlobalMemory extends AbstractGlobalMemory {
private static final Logger LOG = LoggerFactory.getLogger(MacGlobalMemory.class);
private final Supplier<Long> available = memoize(this::queryVmStats, defaultExpiration());
private final Supplier<Long> total = memoize(MacGlobalMemory::queryPhysMem);
... |
try (CloseableLongByReference pPageSize = new CloseableLongByReference()) {
if (0 == SystemB.INSTANCE.host_page_size(SystemB.INSTANCE.mach_host_self(), pPageSize)) {
return pPageSize.getValue();
}
}
LOG.error("Failed to get host page size. Error code: {}"... | 979 | 109 | 1,088 | <methods>public non-sealed void <init>() ,public List<oshi.hardware.PhysicalMemory> getPhysicalMemory() ,public java.lang.String toString() <variables> |
oshi_oshi | oshi/oshi-core/src/main/java/oshi/hardware/platform/mac/MacGraphicsCard.java | MacGraphicsCard | getGraphicsCards | class MacGraphicsCard extends AbstractGraphicsCard {
/**
* Constructor for MacGraphicsCard
*
* @param name The name
* @param deviceId The device ID
* @param vendor The vendor
* @param versionInfo The version info
* @param vram The VRAM
*/
MacGraphic... |
List<GraphicsCard> cardList = new ArrayList<>();
List<String> sp = ExecutingCommand.runNative("system_profiler SPDisplaysDataType");
String name = Constants.UNKNOWN;
String deviceId = Constants.UNKNOWN;
String vendor = Constants.UNKNOWN;
List<String> versionInfoList = ne... | 222 | 458 | 680 | <methods>public java.lang.String getDeviceId() ,public java.lang.String getName() ,public long getVRam() ,public java.lang.String getVendor() ,public java.lang.String getVersionInfo() ,public java.lang.String toString() <variables>private final non-sealed java.lang.String deviceId,private final non-sealed java.lang.Str... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.