NSProcessInfo获取进程信息,UIDevice获取设信息

来源:互联网 发布:java有证书吗 编辑:程序博客网 时间:2024/05/21 00:53

#import <Foundation/Foundation.h>int main(int argc, const char * argv[]) {    @autoreleasepool {        //获取当前进程对应的ProcessInfo对象        NSProcessInfo *proInfo = [NSProcessInfo processInfo];        //获取运行改程序所指定的参数        NSArray *arr = [proInfo arguments];        NSLog(@"运行程序的参数为:%@",arr);        NSLog(@"进程标识符为:%d",[proInfo processIdentifier]);        NSLog(@"进程的进程名为:%@",[proInfo processName]);        NSLog(@"进程所在系统的主机名:%@",[proInfo hostName]);        NSLog(@"进程所在系统的操作系统为:%lu",(unsigned long)[proInfo operatingSystem]);        NSLog(@"进程所在系统的操作系统名为:%@",[proInfo operatingSystemName]);        NSLog(@"进程所在系统的操作系统版本字符串为:%@",[proInfo operatingSystemVersionString]);        NSLog(@"进程所在系统的物理内存为:%lld",[proInfo physicalMemory]);        NSLog(@"进程所在系统的处理器数量为:%ld",[proInfo processorCount]);        NSLog(@"进程所在系统的激活的处理器数量为:%ld",[proInfo activeProcessorCount]);        NSLog(@"进程所在系统的运行时间为:%f",[proInfo systemUptime]);    }    return 0;}

0 0