Raised This Month: $51 Target: $400
 12% 

Solved CPU usage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TBagT
Member
Join Date: Aug 2016
Location: Lithuania
Old 05-25-2017 , 06:24   CPU usage
Reply With Quote #1

Hello,

I am using podbots to test my plugin, after setting that there would be 24 bots and the cpu usage becomes ~20% and then it just stabilizes between 4-6%, is this caused by podbots or the plugin ?
I also tested without any plugins it also goes to around 20% and then stabilizes to ~3% but faster than with the plugin.

Here's a profile from the plugin, I tried caching about every native call to use less of it. But maybe I missed something...
Code:
date: Thu May 25 13:13:21 2017 map: de_dust2
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                          contain |          7 | 0.000000 / 0.000000 / 0.000000
   n |                           strlen |         21 | 0.000002 / 0.000000 / 0.000000
   n |                          replace |          4 | 0.000001 / 0.000000 / 0.000000
   n |                 register_forward |          4 | 0.000009 / 0.000001 / 0.000005
   n |                   precache_sound |         15 | 0.000025 / 0.000001 / 0.000013
   n |                    create_entity |          1 | 0.000007 / 0.000007 / 0.000007
   n |                 DispatchKeyValue |          1 | 0.000003 / 0.000003 / 0.000003
   n |                    DispatchSpawn |          1 | 0.000001 / 0.000001 / 0.000001
   n |                      ArrayCreate |          3 | 0.000005 / 0.000000 / 0.000004
   n |                  register_plugin |          1 | 0.000001 / 0.000001 / 0.000001
   n |                    register_cvar |         12 | 0.000043 / 0.000003 / 0.000007
   n |                register_logevent |          2 | 0.000003 / 0.000001 / 0.000002
   n |                   register_event |          3 | 0.000005 / 0.000001 / 0.000003
   n |                      RegisterHam |          7 | 0.000065 / 0.000005 / 0.000027
   n |                 register_impulse |          1 | 0.000002 / 0.000002 / 0.000002
   n |                   get_user_msgid |          6 | 0.000001 / 0.000000 / 0.000001
   n |                 register_message |          4 | 0.000002 / 0.000000 / 0.000001
   n |                   register_clcmd |          7 | 0.000015 / 0.000001 / 0.000003
   n |                    set_msg_block |          1 | 0.000000 / 0.000000 / 0.000000
   n |                 get_pcvar_string |          2 | 0.000001 / 0.000000 / 0.000000
   n |                  set_cvar_string |          1 | 0.000015 / 0.000015 / 0.000015
   n |                    get_pcvar_num |         10 | 0.000002 / 0.000000 / 0.000000
   n |                     set_cvar_num |          3 | 0.000033 / 0.000011 / 0.000012
   n |                       set_lights |          1 | 0.000001 / 0.000001 / 0.000001
   n |               unregister_forward |          1 | 0.000000 / 0.000000 / 0.000000
   n |                 CreateHudSyncObj |          2 | 0.000001 / 0.000000 / 0.000001
   n |                        ArraySize |          5 | 0.000000 / 0.000000 / 0.000000
   n |                     ArrayGetCell |          3 | 0.000001 / 0.000000 / 0.000001
   n |                   DestroyForward |          1 | 0.000000 / 0.000000 / 0.000000
   n |                     ArrayDestroy |          3 | 0.000006 / 0.000001 / 0.000003
   n |                  register_native |          7 | 0.000015 / 0.000002 / 0.000003
   n |                      is_user_bot |         23 | 0.000003 / 0.000000 / 0.000000
   n |                         set_task |         61 | 0.000148 / 0.000001 / 0.000009
   n |                      remove_task |         51 | 0.000004 / 0.000000 / 0.000001
   n |                 cs_get_user_team |        335 | 0.000115 / 0.000000 / 0.000002
   n |                    is_user_alive |         53 | 0.000009 / 0.000000 / 0.000000
   n |                      get_players |          6 | 0.000005 / 0.000000 / 0.000002
   n |                      task_exists |          2 | 0.000001 / 0.000000 / 0.000001
   n |                  get_msg_arg_int |        152 | 0.000034 / 0.000000 / 0.000001
   n |                  get_pcvar_float |          1 | 0.000000 / 0.000000 / 0.000000
   n |                           random |         16 | 0.000003 / 0.000000 / 0.000001
   n |                    ArrayGetArray |         15 | 0.000017 / 0.000000 / 0.000002
   n |                        give_item |         16 | 0.001130 / 0.000035 / 0.000116
   n |               strip_user_weapons |         15 | 0.000135 / 0.000006 / 0.000013
   n |                          set_pev |         67 | 0.000049 / 0.000000 / 0.000003
   n |               set_user_footsteps |         30 | 0.000008 / 0.000000 / 0.000001
   n |                cs_set_user_money |         16 | 0.000012 / 0.000000 / 0.000001
   n |                  set_user_health |         15 | 0.000002 / 0.000000 / 0.000000
   n |                 set_user_gravity |         15 | 0.000003 / 0.000000 / 0.000000
   n |                cs_set_user_armor |         15 | 0.000011 / 0.000000 / 0.000001
   n |                  cs_get_user_nvg |         15 | 0.000003 / 0.000000 / 0.000000
   n |                  cs_set_user_nvg |         14 | 0.000001 / 0.000000 / 0.000000
   n |                            equal |       1738 | 0.000113 / 0.000000 / 0.000001
   n |                             copy |         26 | 0.000008 / 0.000000 / 0.000001
   n |                     random_float |         13 | 0.000005 / 0.000000 / 0.000001
   n |                get_user_maxspeed |         35 | 0.000010 / 0.000000 / 0.000001
   n |                set_user_maxspeed |         19 | 0.000003 / 0.000000 / 0.000001
   n |                        pev_valid |        163 | 0.000013 / 0.000000 / 0.000001
   n |                              pev |         88 | 0.000006 / 0.000000 / 0.000001
   n |                    remove_entity |          2 | 0.000002 / 0.000001 / 0.000001
   n |                  get_pdata_cbase |         78 | 0.000026 / 0.000000 / 0.000001
   n |                         formatex |        157 | 0.000172 / 0.000000 / 0.000013
   n |                   forward_return |         69 | 0.000313 / 0.000002 / 0.000015
   n |                       random_num |         49 | 0.000009 / 0.000000 / 0.000000
   n |                       emit_sound |         49 | 0.000654 / 0.000007 / 0.000029
   n |                         containi |         23 | 0.000009 / 0.000000 / 0.000001
   n |               get_msg_arg_string |        259 | 0.000082 / 0.000000 / 0.000001
   n |               set_msg_arg_string |          1 | 0.000000 / 0.000000 / 0.000000
   n |                           equali |        163 | 0.000064 / 0.000000 / 0.000002
   n |                        get_param |         21 | 0.000000 / 0.000000 / 0.000000
   n |                       get_string |         12 | 0.000000 / 0.000000 / 0.000000
   n |                      get_param_f |          6 | 0.000000 / 0.000000 / 0.000000
   n |                      file_exists |          9 | 0.000167 / 0.000012 / 0.000031
   n |                 force_unmodified |          6 | 0.000006 / 0.000001 / 0.000002
   n |                   ArrayPushArray |          3 | 0.000001 / 0.000000 / 0.000000
   n |                 CreateOneForward |          1 | 0.000001 / 0.000001 / 0.000001
   n |                    ArrayPushCell |          1 | 0.000000 / 0.000000 / 0.000000
   n |                          engfunc |         72 | 0.000107 / 0.000000 / 0.000011
   n |                          dllfunc |         16 | 0.000078 / 0.000003 / 0.000008
   n |                          vformat |          1 | 0.000001 / 0.000001 / 0.000001
   p |                      FwEmitSound |        362 | 0.000187 / 0.000000 / 0.000004
   p |                client_disconnect |         23 | 0.000010 / 0.000000 / 0.000001
   p |               client_putinserver |         23 | 0.000017 / 0.000000 / 0.000001
   p |                  evHLTV_NewRound |          1 | 0.000001 / 0.000001 / 0.000001
   p |                       evResetHud |         32 | 0.000009 / 0.000000 / 0.000001
   p |                 evResetHudFinish |         46 | 0.000021 / 0.000000 / 0.000001
   p |                 evTextMsgRestart |          1 | 0.000000 / 0.000000 / 0.000000
   p |          fm_cs_user_model_update |         13 | 0.000010 / 0.000000 / 0.000002
   p |          fwChangeGameDescription |         69 | 0.000060 / 0.000000 / 0.000015
   p |                       fwEntSpawn |        101 | 0.000030 / 0.000000 / 0.000001
   p |                    fwKnifeDeploy |         62 | 0.000026 / 0.000000 / 0.000001
   p |               fwPlayerKilledPost |          3 | 0.000001 / 0.000000 / 0.000000
   p |              fwPlayerSpawnedPost |         53 | 0.000043 / 0.000000 / 0.000002
   p |                  fwResetMaxSpeed |        215 | 0.000046 / 0.000000 / 0.000001
   p |              fwSetClientKeyValue |         61 | 0.000036 / 0.000000 / 0.000001
   p |                      levRoundEnd |          2 | 0.000001 / 0.000000 / 0.000001
   p |                    levRoundStart |          2 | 0.000001 / 0.000001 / 0.000001
   p |                     msgRoundTime |        121 | 0.000033 / 0.000000 / 0.000001
   p |                     msgSendAudio |         40 | 0.000020 / 0.000000 / 0.000001
   p |                    msgStatusIcon |        163 | 0.000126 / 0.000000 / 0.000003
   p |                        msgTxtMsg |        152 | 0.000074 / 0.000000 / 0.000002
   p |     native_register_zombie_class |          3 | 0.000005 / 0.000001 / 0.000003
   p |                       plugin_end |          1 | 0.000000 / 0.000000 / 0.000000
   p |                      plugin_init |          1 | 0.000003 / 0.000003 / 0.000003
   p |                   plugin_natives |          1 | 0.000001 / 0.000001 / 0.000001
   p |                  plugin_precache |          1 | 0.000001 / 0.000001 / 0.000001
   p |                taskSearchSpecial |          2 | 0.000002 / 0.000001 / 0.000002
   f |        operator!=(Float:,Float:) |         35 | 0.000005 / 0.000000 / 0.000000
   f |                      replace_all |          3 | 0.000000 / 0.000000 / 0.000000
   f |                   setPlayerHuman |         16 | 0.000010 / 0.000000 / 0.000001
   f |                  setPlayerZombie |         14 | 0.000015 / 0.000000 / 0.000002
   f |             setAttributesByClass |         15 | 0.000017 / 0.000001 / 0.000002
   f |                 fwExecuteSpecial |          2 | 0.000000 / 0.000000 / 0.000000
   f |                       evResetHud |         14 | 0.000002 / 0.000000 / 0.000001
   f |                     HasSecondary |         16 | 0.000004 / 0.000000 / 0.000001
   f |             fm_cs_set_user_model |         13 | 0.000009 / 0.000000 / 0.000002
   f |             fm_cs_get_user_model |         15 | 0.000005 / 0.000000 / 0.000001
   f |           fm_cs_reset_user_model |         16 | 0.000005 / 0.000000 / 0.000001
   f |                client_printcolor |          1 | 0.000001 / 0.000001 / 0.000001
30 natives, 22 public callbacks, 45 function calls were not executed.

Last edited by TBagT; 05-26-2017 at 07:39.
TBagT is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-25-2017 , 07:15   Re: CPU usage
Reply With Quote #2

Bot logic is executed on the server, so yes, they do affect performance. The more bots you have, the more calculations have to be done each frame.
klippy is offline
TBagT
Member
Join Date: Aug 2016
Location: Lithuania
Old 05-25-2017 , 08:05   Re: CPU usage
Reply With Quote #3

What about the profile ? nothing unusual ? Maybe I am missing something, I tried the same amount of podbots on zombie plague mode the highest cpu vas 11% then it dropped to 4-5%.
TBagT is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-25-2017 , 09:16   Re: CPU usage
Reply With Quote #4

Nothing unusual.
klippy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode