Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profiler incorrectly times fixed-cost creep methods #5

Open
bencbartlett opened this issue Feb 24, 2018 · 1 comment
Open

Profiler incorrectly times fixed-cost creep methods #5

bencbartlett opened this issue Feb 24, 2018 · 1 comment

Comments

@bencbartlett
Copy link

I've included relevant parts of a profiler output. The profiler incorrectly records some functions which have a constant cost, shown below. I wrap creep methods as Zerg methods, and in my codebase, most creep action methods are called from a Task, which checks if the action can be performed before calling task.work(). So Task.harvest should have a CPU cost of at least 0.2; many actions which are wrapped in tasks seem to have half of what should be a reasonable CPU value.

Function                                       Tot Calls    CPU/Call  Calls/Tick    CPU/Tick   % of Tot
Overmind:run                                      335715     41.62ms        0.80     33.10ms       14 %
Colony:run                                       3006714      4.65ms        7.12     33.08ms       14 %
Zerg:run                                        70101391      0.12ms      166.04     20.63ms        9 %
Zerg:travelTo                                   24035267      0.16ms       56.93      8.97ms        4 %
TaskHarvest:work                                20646410      0.10ms       48.90      5.13ms        2 %
Zerg:harvest                                    20646410      0.10ms       48.90      5.00ms        2 %
TaskUpgrade:work                                 7679019      0.11ms       18.19      2.03ms        1 %
Zerg:upgradeController                           7679019      0.11ms       18.19      1.98ms        1 %
Zerg:repair                                      4812858      0.12ms       11.40      1.34ms        1 %
TaskDeposit:work                                 3601144      0.13ms        8.53      1.12ms        0 %
Zerg:transfer                                    3601144      0.13ms        8.53      1.09ms        0 %
TaskReserve:work                                 3932616      0.11ms        9.31      1.04ms        0 %
Zerg:reserveController                           3932616      0.11ms        9.31      1.01ms        0 %
TaskRepair:work                                  2154481      0.11ms        5.10      0.54ms        0 %
Zerg:withdraw                                    3342131      0.05ms        7.92      0.40ms        0 %
TaskBuild:work                                    232708      0.16ms        0.55      0.09ms        0 %
Zerg:build                                        232708      0.16ms        0.55      0.09ms        0 %
Zerg:move                                         158493      0.11ms        0.38      0.04ms        0 %
Zerg:pickup                                       612382      0.02ms        1.45      0.03ms        0 %
Zerg:heal                                          38356      0.22ms        0.09      0.02ms        0 %
Zerg:dismantle                                      9091      0.22ms        0.02      0.00ms        0 %
Zerg:attack                                         5967      0.21ms        0.01      0.00ms        0 %
Zerg:suicide                                        3564      0.23ms        0.01      0.00ms        0 %
Zerg:rangedHeal                                     3120      0.25ms        0.01      0.00ms        0 %

422201 total ticks measured			240.88 average CPU profiled per tick
@ricochet1k
Copy link

If the harvest call fails, it shouldn't use the fixed 0.2 CPU intent cost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants