View Javadoc
1   /*
2    * Copyright 2020-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.software.os.mac;
6   
7   import oshi.annotation.concurrent.ThreadSafe;
8   import oshi.software.common.AbstractOSThread;
9   import oshi.software.os.OSProcess.State;
10  
11  /**
12   * OSThread implementation
13   */
14  @ThreadSafe
15  public class MacOSThread extends AbstractOSThread {
16  
17      private final int threadId;
18      private final State state;
19      private final long kernelTime;
20      private final long userTime;
21      private final long startTime;
22      private final long upTime;
23      private final int priority;
24  
25      public MacOSThread(int pid, int threadId, State state, long kernelTime, long userTime, long startTime, long upTime,
26              int priority) {
27          super(pid);
28          this.threadId = threadId;
29          this.state = state;
30          this.kernelTime = kernelTime;
31          this.userTime = userTime;
32          this.startTime = startTime;
33          this.upTime = upTime;
34          this.priority = priority;
35      }
36  
37      public MacOSThread(int processId) {
38          this(processId, 0, State.INVALID, 0L, 0L, 0L, 0L, 0);
39      }
40  
41      @Override
42      public int getThreadId() {
43          return threadId;
44      }
45  
46      @Override
47      public State getState() {
48          return state;
49      }
50  
51      @Override
52      public long getKernelTime() {
53          return kernelTime;
54      }
55  
56      @Override
57      public long getUserTime() {
58          return userTime;
59      }
60  
61      @Override
62      public long getStartTime() {
63          return startTime;
64      }
65  
66      @Override
67      public long getUpTime() {
68          return upTime;
69      }
70  
71      @Override
72      public int getPriority() {
73          return priority;
74      }
75  }