pid

服务器cpu占用100%,如何排查

旧巷老猫 提交于 2019-12-01 19:01:29
生产环境服务器出现cpu占用100%,如何排查?本文从linux和windows给出排查思路。 大致流程是找出进程的pid-找到进程下占用资源最大的线程-打印出进程快照 linux: 1.top -c找到占用cpu较高的进程,获取到[pid] 2.top -Hp [pid],查看该进程对应的线程,找到线程中占用cpu较高的线程id(tid) 3.jstack -l [pid] > /path/[pid].stack,打印出进程此时的快照 4.vi [pid].stack或者cat [pid].stack|grep '[tid]的16进制' -C 8,查看该线程在cpu占用100%时做了什么 windows: 1.在任务管理中找到占用cpu较高的进程,获取[pid] 2.使用Process Explorer获取该[pid]对应的线程,找到占用资源较高的线程id(tid) 3.cmd窗口中输入jstack -l [pid] > /path/[pid].txt 4.打开文件[pid].txt,查找[tid]的16进制所在的行,查看具体信息 来源: https://www.cnblogs.com/jinziguang/p/11713380.html

手把手教你看懂并理解Arduino PID控制库——引子

£可爱£侵袭症+ 提交于 2019-12-01 18:22:08
介绍 本文主要依托于Brett Beauregard大神针对Arduino平台撰写的PID控制库 Arduino PID Library 及其对应的帮助博客 Improving the Beginner’s PID 。在没有Brett Beauregard帮助之前,也尝试过按照PID控制基本理论写过PID控制程序,并成功应用于工业设备中,但从未深入考虑过将其写成适合工业控制的通用库。根据Brett Beauregard的理念,此PID库主要想为以下两类人服务: 想要从事Arduino PID控制的同志,提供一个快速入门的方法 已经拥有自己的PID控制算法,想要从中获取到一些新点子的同志。 本文在上述基础上,主要有以下几方面工作: 对Brett Beauregard的PID控制库代码进行必要的说明 对其博客教程核心思想进行必要的说明 对其依托PID控制库改进的autoPID控制库进行必要的说明。 背景 接触过PID控制的工程师应当都会对下面的公式印象深刻: 上述公式的具体说明就不加以说明了,请各位参考维基百科的PID controller。大部分同志可能会写出如下代码(或者类似),包括我自己 /*working variables*/ unsigned long lastTime; double Input, Output, Setpoint; double errSum,

记录一次Metaspace扩容引发FGC的调优总结

删除回忆录丶 提交于 2019-12-01 16:41:41
开始之前   在开始之前先记录一个我碰到的jvm调优的坑。那就是… 为啥我配置到idea64exe.vmoptions中的参数没有生效???   由于之前一直是在mac上开发,本地开发时当需要优化jvm参数的时候直接去idea的安装目录里修改idea.vmoptions就可以了,换到windows以后想当然的也这么改,但是发现似乎我配置的参数并没有生效, what‘s the f***?探索了一番终于发现了问题所在。   windows是基于用户登录的,idea会为每个用户在当前用户根目录下创建一份配置信息,所以在idea安装目录下修改idea.vmoptions是不生效的,如图:   不知道管理员用户登录的话是不是就可以直接修改idea安装目录的ideaexe.vmoptions了,有一个很简单的方法判断你当前的idea项目使用的是哪里的配置信息。 发现问题   ok,现在终于可以优化我们的jvm参数了,下面是一套我经常用的参数,在我以前开发的时候基本都是用这套参数,我也就直接复制到了idea64exe.vmoptions。 -Xms1024m -Xmx1024m -Xmn512m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -XX:ReservedCodeCacheSize=512m -XX:

Wait until a certain process (knowing the “pid”) end

牧云@^-^@ 提交于 2019-12-01 15:05:18
I have this: def get_process(): pids = [] process = None for i in os.listdir('/proc'): if i.isdigit(): pids.append(i) for pid in pids: proc = open(os.path.join('/proc', pid, 'cmdline'), 'r').readline() if proc == "Something": process = pid return process def is_running(pid): return os.path.exists("/proc/%s" % str(pid)) Then i do this: process = get_process() if process == None: #do something else: #Wait until the process end while is_running(process): pass I think this is not the best way to wait for the process to terminate, there must be some function wait or something, but i can't find it.

Batch File runs manually but not in task scheduler

限于喜欢 提交于 2019-12-01 12:54:46
I have a batch file, which will search for a java process and kill the same. The script works fine when the bat file is run on the command prompt. But when I tried to execute in task scheduler, it is not working. I have selected the option "Run whether the user is logged in or not" My batch file is as given below: for /F "tokens=1*" %%i in ('jps -lv^|C:\Windows\System32\find.exe "TaskTest"') do (C:\Windows\System32\taskkill.exe /F /PID %%i ) I have also tried whatever is mentioned in this link Batch runs manually but not in scheduled task Any other suggestions please. Note: I have another

Batch File runs manually but not in task scheduler

末鹿安然 提交于 2019-12-01 10:53:50
问题 I have a batch file, which will search for a java process and kill the same. The script works fine when the bat file is run on the command prompt. But when I tried to execute in task scheduler, it is not working. I have selected the option "Run whether the user is logged in or not" My batch file is as given below: for /F "tokens=1*" %%i in ('jps -lv^|C:\Windows\System32\find.exe "TaskTest"') do (C:\Windows\System32\taskkill.exe /F /PID %%i ) I have also tried whatever is mentioned in this

python 创建后台守护进程

让人想犯罪 __ 提交于 2019-12-01 10:07:40
如果你要使你的python服务不受终端影响而常驻系统,就需要将它变成守护进程。下面给出python代码: [Python] 纯文本查看 复制代码 ? 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 [ / p][p = 26 , null, left] # coding=utf8 import os import sys import atexit def daemonize(pid_file = None ): """ 创建守护进程 :param pid_file: 保存进程id的文件 :return: """ # 从父进程fork一个子进程出来 pid = os.fork() # 子进程的pid一定为0,父进程大于0 if pid: # 退出父进程,sys.exit()方法比os._exit()方法会多执行一些刷新缓冲工作 sys.exit( 0 ) # 子进程默认继承父进程的工作目录,最好是变更到根目录,否则回影响文件系统的卸载 os.chdir( '/' ) # 子进程默认继承父进程的umask(文件权限掩码),重设为0(完全控制)

pgsql 解锁表

妖精的绣舞 提交于 2019-12-01 08:12:25
SELECT pid FROM PG_LOCKS WHERE relation in ( SELECT relnamespace, reltype, oid FROM PG_CLASS WHERE RELNAME LIKE '%tablename%'); 然后,将pid数组 select pg_cancel_backend(pid[0]); select pg_cancel_backend(pid[1]); select pg_cancel_backend(pid[i]); 来源: https://www.cnblogs.com/greys/p/11672315.html

PID:我应该何时计算积分项?

吃可爱长大的小学妹 提交于 2019-12-01 06:39:30
  最近看到了Brett Beauregard发表的有关PID的系列文章,感觉对于理解PID算法很有帮助,于是将系列文章翻译过来!在自我提高的过程中,也希望对同道中人有所帮助。作者Brett Beauregard的原文网址: http://brettbeauregard.com/blog/2011/07/pid-when-should-i-compute-the-integral-term/   最近有一个建议张贴到初学者的PID系列。争议的焦点是,如果您解决拉普拉斯域中的问题,它指定了执行积分项的不同方式。评论人士建议,与其看某一点的误差总和,不如看最后一个点的总和。   因此,当前的代码是这样的: 1 /*Compute all the working error variables*/ 2 double input = *myInput; 3 double error = *mySetpoint - input; 4 ITerm+= (ki * error); 5 if(ITerm > outMax) ITerm= outMax; 6 else if(ITerm < outMin) ITerm= outMin; 7 double dInput = (input - lastInput); 8 9 /*Compute PID Output*/ 10 double output

Getting a pid of a process created in C#

旧城冷巷雨未停 提交于 2019-12-01 05:16:17
Lets say that I'm trying to create a new process with the following code: System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); p.StartInfo.FileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\AwesomeFile.exe"; p.StartInfo.Arguments = "parameter1 parameter2"; p.StartInfo.CreateNoWindow = true; p.Start(); and right in the next line, I'll try to get a pid of that process with the following