Linkgraph: Changes to job scheduling algorithm.

This is to improve responsiveness of link graph updates, whilst
avoiding being blocked waiting for updates to complete.
Previously, large numbers of cheap jobs resulted in poor responsiveness
as it took a long time for jobs to cycle round.

Add 'linkgraph' debug category.
This commit is contained in:
Jonathan G Rennison
2016-10-31 00:21:01 +00:00
parent 7f10d83a4a
commit 84e61b690a
7 changed files with 82 additions and 24 deletions

View File

@@ -15,6 +15,7 @@
#include "../core/pool_type.hpp"
#include "../core/smallmap_type.hpp"
#include "../core/smallmatrix_type.hpp"
#include "../core/bitmath_func.hpp"
#include "../station_base.h"
#include "../cargotype.h"
#include "../date_func.h"
@@ -523,6 +524,11 @@ public:
NodeID AddNode(const Station *st);
void RemoveNode(NodeID id);
inline uint CalculateCostEstimate() const {
uint64_t size_squared = this->Size() * this->Size();
return size_squared * FindLastBit(size_squared * size_squared); // N^2 * 4log_2(N)
}
protected:
friend class LinkGraph::ConstNode;
friend class LinkGraph::Node;