Mercurial > prosody-hg
comparison core/statsmanager.lua @ 6582:71b5de1d830b
statsmanager: Fire event at the start of collection to allow for polling
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 10 Mar 2015 16:26:25 +0100 |
| parents | 1e749832ed3b |
| children | 82765a4ec799 |
comparison
equal
deleted
inserted
replaced
| 6580:74946f050209 | 6582:71b5de1d830b |
|---|---|
| 26 local mark_collection_start = measure("times", "stats.collection"); | 26 local mark_collection_start = measure("times", "stats.collection"); |
| 27 local mark_processing_start = measure("times", "stats.processing"); | 27 local mark_processing_start = measure("times", "stats.processing"); |
| 28 | 28 |
| 29 function collect() | 29 function collect() |
| 30 local mark_collection_done = mark_collection_start(); | 30 local mark_collection_done = mark_collection_start(); |
| 31 fire_event("stats-update"); | |
| 31 changed_stats, stats_extra = {}, {}; | 32 changed_stats, stats_extra = {}, {}; |
| 32 for stat_name, getter in pairs(stats.get_stats()) do | 33 for stat_name, getter in pairs(stats.get_stats()) do |
| 33 local type, value, extra = getter(); | 34 local type, value, extra = getter(); |
| 34 local old_value = latest_stats[stat_name]; | 35 local old_value = latest_stats[stat_name]; |
| 35 latest_stats[stat_name] = value; | 36 latest_stats[stat_name] = value; |
