Class: NSProcessInfo
Overview
The NSProcessInfo class provides methods to access information about the current process. Each process has a single, shared NSProcessInfo object, known as process information agent.
Class Method Summary (collapse)
-
+ processInfo
Returns the process information agent for the process.
Instance Method Summary (collapse)
-
- activeProcessorCount
Provides the number of active processing cores available on the computer.
-
- arguments
Returns the command-line arguments for the process.
-
- environment
Returns the variable names and their values in the environment from which the process was launched.
-
- globallyUniqueString
Returns a global unique identifier for the process.
-
- hostName
Returns the name of the host computer.
-
- operatingSystem
Returns a constant to indicate the operating system on which the process is executing.
-
- operatingSystemName
Returns a string containing the name of the operating system on which the process is executing.
-
- operatingSystemVersionString
Returns a string containing the version of the operating system on which the process is executing.
-
- physicalMemory
Provides the amount of physical memory on the computer.
-
- processIdentifier
Returns the identifier of the process.
-
- processName
Returns the name of the process.
-
- processorCount
Provides the number of processing cores available on the computer.
-
- setProcessName:
Sets the name of the process.
-
- systemUptime
Returns how long it has been since the computer has been restarted.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Class Method Details
+ (NSProcessInfo) processInfo
Returns the process information agent for the process. An NSProcessInfo object is created the first time this method is invoked, and that same object is returned on each subsequent invocation.
Instance Method Details
- (Integer) activeProcessorCount
Provides the number of active processing cores available on the computer.
- (Array) arguments
Returns the command-line arguments for the process.
- (Hash) environment
Returns the variable names and their values in the environment from which the process was launched.
- (String) globallyUniqueString
Returns a global unique identifier for the process. This method generates a new string each time it is invoked, so it also uses a counter to guarantee that strings created from the same process are unique.
- (String) hostName
Returns the name of the host computer.
- (Integer) operatingSystem
Returns a constant to indicate the operating system on which the process is executing.
- (String) operatingSystemName
Returns a string containing the name of the operating system on which the process is executing.
- (String) operatingSystemVersionString
Returns a string containing the version of the operating system on which the process is executing.
- (Integer) physicalMemory
Provides the amount of physical memory on the computer.
- (Integer) processIdentifier
Returns the identifier of the process.
- (String) processName
Returns the name of the process. The process name is used to register application defaults and is used in error messages. It does not uniquely identify the process.
- (Integer) processorCount
Provides the number of processing cores available on the computer.
- (Object) setProcessName(name)
Sets the name of the process. Warning:
User defaults and other aspects of the environment might depend on the process name, so be very careful if you change it. Setting the process name in this manner is not thread safe.
- (NSTimeInterval) systemUptime
Returns how long it has been since the computer has been restarted.