<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Process Utilization per Core in Scripts</title>
    <link>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72453#M594</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="espupc123.JPG" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9442iD07A83C0CA803E69/image-size/medium?v=v2&amp;amp;px=400" role="button" title="espupc123.JPG" alt="espupc123.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;With this onliner you can view the process load of each core. &lt;BR /&gt;Change the variable CORE to the correct core number (for example CORE=3):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;CORE=3; ps --sort=-c -e -o pid,psr,%cpu,%mem,cmd | grep -E  "^[[:space:]][[:digit:]]+[[:space:]]+${CORE}"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ps L       -&amp;gt; List all format specifiers (for example pid, psr, %cpu, %mem, ...)&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ps_core_2.jpg" style="width: 797px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/4007iBE73C4575086851F/image-dimensions/797x283?v=v2" width="797" height="283" role="button" title="ps_core_2.jpg" alt="ps_core_2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;There is still much potential for improvement here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Dec 2020 16:17:15 GMT</pubDate>
    <dc:creator>HeikoAnkenbrand</dc:creator>
    <dc:date>2020-12-01T16:17:15Z</dc:date>
    <item>
      <title>Process Utilization per Core</title>
      <link>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72453#M594</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="espupc123.JPG" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9442iD07A83C0CA803E69/image-size/medium?v=v2&amp;amp;px=400" role="button" title="espupc123.JPG" alt="espupc123.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;With this onliner you can view the process load of each core. &lt;BR /&gt;Change the variable CORE to the correct core number (for example CORE=3):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;CORE=3; ps --sort=-c -e -o pid,psr,%cpu,%mem,cmd | grep -E  "^[[:space:]][[:digit:]]+[[:space:]]+${CORE}"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ps L       -&amp;gt; List all format specifiers (for example pid, psr, %cpu, %mem, ...)&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ps_core_2.jpg" style="width: 797px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/4007iBE73C4575086851F/image-dimensions/797x283?v=v2" width="797" height="283" role="button" title="ps_core_2.jpg" alt="ps_core_2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;There is still much potential for improvement here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 16:17:15 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72453#M594</guid>
      <dc:creator>HeikoAnkenbrand</dc:creator>
      <dc:date>2020-12-01T16:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: ONELINER  - process utilization per core</title>
      <link>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72466#M595</link>
      <description>&lt;P&gt;I always use this one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;watch -n 1 'CORE=2; ps --sort=-c -e -o pid,psr,%cpu,%mem,wchan,vsize,time,cmd | grep -E  "^[[:space:]][[:digit:]]+[[:space:]]+${CORE}"'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt; Refresh display every second&lt;BR /&gt;&amp;gt; For core two (set CORE=x parameter)&lt;BR /&gt;&amp;gt; Is sorted by CPU load&lt;BR /&gt;&amp;gt; The following fields are used:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; - Process ID&lt;BR /&gt;&amp;nbsp;&amp;nbsp; - Core&lt;BR /&gt;&amp;nbsp;&amp;nbsp; - CPU utilization in %&lt;BR /&gt;&amp;nbsp;&amp;nbsp; - Memory utilization in %&lt;BR /&gt;&amp;nbsp;&amp;nbsp; - Process type&lt;BR /&gt;&amp;nbsp;&amp;nbsp; - Process memory usage in KB&lt;BR /&gt;&amp;nbsp;&amp;nbsp; - Process time&lt;BR /&gt;&amp;nbsp;&amp;nbsp; - Process path+command&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="onliner_ps_1.JPG" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/4016iA4A1488A30F7951F/image-size/large?v=v2&amp;amp;px=999" role="button" title="onliner_ps_1.JPG" alt="onliner_ps_1.JPG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;If you want to sort it by memory usage, use this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;watch -n 1 'CORE=2; ps --sort=-vsize -e -o pid,psr,%cpu,%mem,wchan,vsize,time,cmd | grep -E  "^[[:space:]][[:digit:]]+[[:space:]]+${CORE}"'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 12:07:08 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72466#M595</guid>
      <dc:creator>HeikoAnkenbrand</dc:creator>
      <dc:date>2020-01-17T12:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: ONELINER  - process utilization per core</title>
      <link>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72481#M596</link>
      <description>&lt;P&gt;Really like this one-liner, made a small change to have it run over all cores and sort by CPU usage or Memory usage:&lt;/P&gt;
&lt;P&gt;Sort by CPU:&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;echo "" &amp;gt; coreload.txt ; for (( cpuCore = 0; cpuCore &amp;lt; $(cpstat os -f cpu | grep Number: | awk '{print $3}'); ++cpuCore )); do CORE=${cpuCore}; ps -e -o pid,psr,%cpu,%mem,cmd | grep -E "^[[:space:]][[:digit:]]+[[:space:]]+${CORE}" &amp;gt;&amp;gt; coreload.txt; done ; cat coreload.txt | sort -k3 -gr&lt;/LI-CODE&gt;
&lt;P&gt;Sort by Memory:&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;echo "" &amp;gt; coreload.txt ; for (( cpuCore = 0; cpuCore &amp;lt; $(cpstat os -f cpu | grep Number: | awk '{print $3}'); ++cpuCore )); do CORE=${cpuCore}; ps -e -o pid,psr,%cpu,%mem,cmd | grep -E "^[[:space:]][[:digit:]]+[[:space:]]+${CORE}" &amp;gt;&amp;gt; coreload.txt; done ; cat coreload.txt | sort -k4 -gr&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 17 Jan 2020 00:00:50 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72481#M596</guid>
      <dc:creator>KernelGordon</dc:creator>
      <dc:date>2020-01-17T00:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: ONELINER  - process utilization per core</title>
      <link>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72520#M597</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/4424"&gt;@KernelGordon&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;You can use this! It is quick and easy:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ps --sort=-c -e -o pid,psr,%cpu,%mem,wchan,vsize,time,cmd&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;ps --sort=-vsize -e -o pid,psr,%cpu,%mem,wchan,vsize,time,cmd&lt;/LI-CODE&gt;
&lt;P&gt;You can sort directly into ps with "--sort". If you use a "--sort=-" it will sort in reverse order &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 11:39:25 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72520#M597</guid>
      <dc:creator>HeikoAnkenbrand</dc:creator>
      <dc:date>2020-01-17T11:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: ONELINER  - process utilization per core</title>
      <link>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72526#M598</link>
      <description>&lt;P&gt;Or just to monitor the firewall workers&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;watch -n 1 'ps --sort=-c -e -o pid,psr,%cpu,%mem,wchan,time,cmd |grep "fw_worker_"|grep -v pipe|grep -v grep '
&lt;/LI-CODE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="firewall_worker_1.JPG" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/4015i7C5F32738FB70242/image-size/medium?v=v2&amp;amp;px=400" role="button" title="firewall_worker_1.JPG" alt="firewall_worker_1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 11:56:14 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72526#M598</guid>
      <dc:creator>HeikoAnkenbrand</dc:creator>
      <dc:date>2020-01-17T11:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: ONELINER  - process utilization per core</title>
      <link>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72567#M599</link>
      <description>&lt;P&gt;Nice find! I wasn't aware of the 'psr' format specifier. Time to read the man page and see if there are any other neat things to add to this &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 19:08:20 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/Process-Utilization-per-Core/m-p/72567#M599</guid>
      <dc:creator>KernelGordon</dc:creator>
      <dc:date>2020-01-17T19:08:20Z</dc:date>
    </item>
  </channel>
</rss>

