uptime

Get the precise time of system bootup on iOS/OS X

限于喜欢 提交于 2019-11-28 21:41:27
Is there an API to obtain the NSDate or NSTimeInterval representing the time the system booted? Some APIs such as [NSProcessInfo systemUptime] and Core Motion return time since boot. I need to precisely correlate these uptime values with NSDate s, to about a millisecond. Time since boot ostensibly provides more precision, but it's easy to see that NSDate already provides precision on the order of 100 nanoseconds, and anything under a microsecond is just measuring interrupt latency and PCB clock jitter. The obvious thing is to subtract the uptime from the current time [NSDate date] . But that

Hot deploy on Heroku with no downtime

孤人 提交于 2019-11-28 18:37:15
A bad side of pushing to Heroku is that I must push the code (and the server restarts automatically) before running my db migrations. This can obviously cause some 500 errors on users navigating the website having the new code without the new tables/attributes: the solution proposed by Heroku is to use the maintenance mode, but I want a way with no downside letting my webapp running everytime! Is there a way? For example with Capistrano: I prepare the code to deploy in a new dir I run (backward) migrations and the old code continue to work perfectly I swith mongrel instance to the new dir and

/proc/uptime参数的意义

两盒软妹~` 提交于 2019-11-28 17:34:18
有关/proc/uptime这个文件里两个参数所代表的意义: [root@app ~]#cat /proc/uptime 3387048.81 3310821.00 第一个参数是代表从系统启动到现在的时间(以秒为单位): 3387048.81秒 = 39.20195381944444天,说明这台服务器已连续开机39.20195381944444天 第二个参数是代表系统空闲的时间(以秒为单位): 3310821.00秒 = 38.3196875天,说明这台机器从开机到现在一共只有38天左右没事干。 计算一下空闲率: 3310821.00 / 3387048.81 = 0.9774943278718207 也就是说:它的空闲率是97% 空闲率高低并不意味着,它做的工作很多,还有跟服务器的配置和性能有很大的关系,这台服务器有这么低的空闲率,或者说这么高的利用率,是因为它的配置比较低。 空闲率跟服务器的配置有很大的关系,服务器的性能越好,配置越高,它处理的速度越快,配置高的服务器处理的时间要小于配置低的服务器。 从空闲时间,你就可以判断你的服务器负载是否过大,看一下是不是有导常情况发生,如果空闲时间很小,说明你的服务器已经在满负荷运行,然后决定是不是需要升级你的服务器。 来源: https://www.cnblogs.com/xingmuxin/p/11416486.html

Erlang's 99.9999999% (nine nines) reliability

拟墨画扇 提交于 2019-11-28 14:47:02
问题 Erlang was reported to have been used in production systems for over 20 years with an uptime percentage of 99.9999999%. I did the math as the following: 20*365.25*24*60*60*(1 - 0.999999999) == 0.631 s That means the system only has less than one second of downtime during the period of 20 years. I am not trying to challenge the validity of this, I am just curious about how we can shut down a system (on purpose or by accident) for only 0.631 second. Could anyone who are familiar with large

Linux150个常用命令

…衆ロ難τιáo~ 提交于 2019-11-28 10:38:25
Linux命令大全网址: 1. 线上查询及帮助命令(1个) help:获取某个命令的帮助信息,格式:命令 --help 2. 文件和目录操作命令(12个) ls:列出当前目录下的所有文件和文件夹。常用参数:-l 除文件名称外,亦将文件型态、权限、拥有者、文件大小等资讯详细列出。 tree:以树状图列出目录中的内容。 pwd:显示当前目录的路径。 mkdir:在当前目录下创建子目录。常用参数:-p 确保目录存在,不存在则创建,创建多级目录时会用到。 rmdir:删除空的目录。常用参数:-p 删除子目录后父目录为空时,父目录也会被删除,删除多级目录时会用到。 cd:切换目录。目录省略时,切换到当前登录者的home目录,与“~”的效果一样;“..”表示切换到上级目录;“.”表示当前目录;“-”表示切换到上次使用的目录。 touch:创建文件。文件存在时,会将文件的时间属性修改为当前时间。 cp:复制文件或目录到新目录中。常用参数:-a 复制目录时保留目录链接、属性及复制目录中所有内容;-r 复制目录时需要用到;-f 新目录中存在相同内容时直接覆盖不提示;-i 有相同内容时会先提示。 mv:移动文件或目录到新目录中,或者修改文件名。常用参数:-f -i 作用与cp的参数作用相同。修改文件名:mv 文件名 新文件名 rm:删除文件或者目录。常用参数:-f -i 作用与cp的参数作用相同。-r

How to retrieve the process start time (or uptime) in python

余生颓废 提交于 2019-11-28 06:46:05
How to retrieve the process start time (or uptime) in python in Linux? I only know, I can call "ps -p my_process_id -f" and then parse the output. But it is not cool. If you are doing it from within the python program you're trying to measure, you could do something like this: import time # at the beginning of the script startTime = time.time() # ... def getUptime(): """ Returns the number of seconds since the program started. """ # do return startTime if you just want the process start time return time.time() - startTime Otherwise, you have no choice but to parse ps or go into /proc/pid . A

Get the precise time of system bootup on iOS/OS X

本小妞迷上赌 提交于 2019-11-27 21:02:13
问题 Is there an API to obtain the NSDate or NSTimeInterval representing the time the system booted? Some APIs such as [NSProcessInfo systemUptime] and Core Motion return time since boot. I need to precisely correlate these uptime values with NSDate s, to about a millisecond. Time since boot ostensibly provides more precision, but it's easy to see that NSDate already provides precision on the order of 100 nanoseconds, and anything under a microsecond is just measuring interrupt latency and PCB

OSX: programmatically get uptime?

我是研究僧i 提交于 2019-11-27 17:54:11
问题 Something similar to linux cat /proc/uptime which returns the uptime in seconds, and preferably not parsing uptime(1). 回答1: The Uptime article on Wikipedia has an interesting lead: Using sysctl There is also a method of using sysctl to call the system's last boot time: $ sysctl kern.boottime kern.boottime: { sec = 1271934886, usec = 667779 } Thu Apr 22 12:14:46 2010 Which references sysctl(8), which references sysctl(3). 回答2: Old question, I know, but I needed to do the same thing so I

Hot deploy on Heroku with no downtime

ε祈祈猫儿з 提交于 2019-11-27 11:32:28
问题 A bad side of pushing to Heroku is that I must push the code (and the server restarts automatically) before running my db migrations. This can obviously cause some 500 errors on users navigating the website having the new code without the new tables/attributes: the solution proposed by Heroku is to use the maintenance mode, but I want a way with no downside letting my webapp running everytime! Is there a way? For example with Capistrano: I prepare the code to deploy in a new dir I run

Retrieve system uptime using C#

北城余情 提交于 2019-11-26 18:40:23
Is there a simple way to get a system's uptime using C#? public TimeSpan UpTime { get { using (var uptime = new PerformanceCounter("System", "System Up Time")) { uptime.NextValue(); //Call this an extra time before reading its value return TimeSpan.FromSeconds(uptime.NextValue()); } } } I'm a bit late, but another simple way is to use the GetTickCount64 function, which is available starting with Windows Vista and does not overflow as GetTickCount does: public static TimeSpan GetUpTime() { return TimeSpan.FromMilliseconds(GetTickCount64()); } [DllImport("kernel32")] extern static UInt64