×ðÁú¿­Ê±

linuxÉó²éÀú³Ìʱ¼ä

ÔÚ linux ϵͳÖÐ  £¬ÓÐÒÔÏÂÒªÁìÉó²éÀú³Ìʱ¼ä£ºÊ¹Óà ps ÏÂÁÏÔʾÀú³Ì id ºÍÒÑÓÃʱ¼ä£©£º$ ps -eo pid,etimeʹÓà uptime ÏÂÁÏÔʾϵͳÔËÐÐʱ¼ä£©£º$ uptimeʹÓà top ÏÂÁ°´ÓÃʱÅÅÐòÀú³Ì£©£º$ top -tʹÓà pidstat ÏÂÁÏÔʾÏêϸÐÔÄÜͳ¼ÆÐÅÏ¢£©£º$ pidstat -d -p

ÔõÑùÔÚ Linux ÖÐÉó²éÀú³Ìʱ¼ä

Éó²éÀú³ÌµÄÔËÐÐʱ¼ä¹ØÓÚÐÔÄÜÆÊÎöºÍ¹ÊÕÏɨ³ýÖÁ¹ØÖ÷Òª¡£ÔÚ Linux ϵͳÖÐ  £¬¿ÉÒÔͨ¹ý¶àÖÖÏÂÁîʵÏÖÕâһĿµÄ¡£

1. ʹÓà ps ÏÂÁî

ps ÏÂÁîÊÇÉó²éÀú³ÌÐÅÏ¢µÄ³£Óù¤¾ß¡£Ëü¿ÉÒÔÔÚÖÕ¶ËÖÐʹÓà  £¬²¢ÌṩÒÔÏÂÑ¡Ï

-p £ºÖ¸¶¨Ìض¨Àú³Ì ID¡£

-e£ºÏÔʾËùÓÐÀú³Ì¡£

-eo pid,etime£ºÏÔʾÀú³Ì ID ºÍÔËÐÐʱ¼ä£¨ÒÑÓÃʱ¼ä£©¡£

ÀýÈ磺

$ ps -eo pid,etime
PID   ELAPSED
2832  00:31:36
3062  00:01:15
3707  00:00:00

µÇ¼ºó¸´ÖÆ

2. ʹÓà uptime ÏÂÁî

uptime ÏÂÁîÏÔʾϵһÇмÆÐÅÏ¢  £¬°üÀ¨Ä¿½ñʱ¼äºÍϵͳÒÑÔËÐÐʱ¼ä¡£Ëü»¹¿ÉÒÔÌṩÓйØÀú³Ì×ÜÊýÇå¾²¾ù¸ºÔصÄÐÅÏ¢¡£

ÀýÈ磺

$ uptime
16:02:03 up 17 days, 17:59,  4 users,  load average: 2.31, 2.42, 2.40

µÇ¼ºó¸´ÖÆ

3. ʹÓà top ÏÂÁî

top ÏÂÁîÌṩʵʱµÄÀú³ÌÐÅÏ¢ÊÓͼ¡£Ëü¿ÉÒÔ°´ CPU ʹÓÃÂÊ¡¢ÄÚ´æʹÓÃÂÊ»òÆäËûÖ¸±ê¶ÔÀú³Ì¾ÙÐÐÅÅÐò¡£

ÒªÉó²éÀú³ÌµÄÔËÐÐʱ¼ä  £¬Çë°´ F ¼ü½øÈëÈ«ÆÁģʽ  £¬È»ºó°´ t ¼ü¶ÔÀú³Ì°´ÓÃʱ¾ÙÐÐÅÅÐò¡£

ÀýÈ磺

$ top -t
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
1066 root      20   0  1706m  55m 1012 S  2.5  0.6   1:07.29 mysqld
7576 root      20   0   280m  17m  716 S  0.0  0.2   0:00.00 rsyslogd
9982 user      20   0  1404m 212m  816 S  1.0  2.3   0:00.05 python3

µÇ¼ºó¸´ÖÆ

4. ʹÓà pidstat ÏÂÁî

pidstat ÏÂÁîÌṩÓйØÀú³ÌµÄÏêϸÐÔÄÜͳ¼ÆÐÅÏ¢  £¬°üÀ¨ CPU ʹÓÃÂÊ¡¢ÄÚ´æʹÓÃÂÊºÍ I/O Ô˶¯¡£

ÒªÉó²éÀú³ÌµÄÔËÐÐʱ¼ä  £¬ÇëʹÓà -p Ñ¡ÏîÖ¸¶¨Àú³Ì ID¡£

ÀýÈ磺

$ pidstat -d -p 1066 1 5
Linux 5.10.0-1040-azure (buildd@lcy01-amd64-016) (x86_64)
10:40:30 pm        CPU      %usr   %system %guest    %wait    %idle
10:40:31 pm        all    98.06    1.94     0.00    0.00    0.00
               usr    97.99    2.01     0.00    0.00    0.00
               sys     0.07    0.00     0.00    0.00    0.00
               wai     0.00    0.00     0.00    0.00    0.00
               idl     0.00    0.00     0.00    0.00    0.00
10:40:32 pm        all    97.93    2.07     0.00    0.00    0.00
               usr    97.93    1.99     0.01    0.00    0.00
               sys     0.00    0.08     0.00    0.00    0.00
               wai     0.00    0.00     0.00    0.00    0.00
               idl     0.00    0.00     0.00    0.00    0.00
Process 1066 (mysqld),  98.06% usr,  1.94% sys, 0.00% guest, 0.00% wait, 0.00% idle

µÇ¼ºó¸´ÖÆ

ÉÏÊöÏÂÁÿÃë¸üÐÂÒ»´ÎÀú³Ìͳ¼ÆÐÅÏ¢  £¬Ò»Á¬ 5 Ãë¡£Äú¿ÉÒÔÔÚ TIME+ ×Ö¶ÎÖп´µ½Àú³ÌµÄÄ¿½ñÔËÐÐʱ¼ä¡£

ÒÔÉϾÍÊÇlinuxÉó²éÀú³Ìʱ¼äµÄÏêϸÄÚÈÝ  £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí  £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø  £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È  £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ  £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢  £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢  £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå  £¬9:30-18:30  £¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿