支持全局函数补全

This commit is contained in:
csh
2025-09-27 22:23:04 +08:00
parent aac12137cb
commit dc713e6893
220 changed files with 195514 additions and 195869 deletions
+29 -30
View File
@@ -167,10 +167,8 @@ namespace lsp::scheduler
UnregisterTask(request_id);
// Periodic status logging
if (total_completed_.load() % kStatusLogInterval == 0)
{
if (total_completed_.load() % kStatusLogInterval * 10 == 0)
LogStatus();
}
}
bool Request::RegisterTask(const std::string& request_id, TaskContextPtr context)
@@ -286,34 +284,35 @@ namespace lsp::scheduler
void Request::LogStatus() const
{
auto stats = GetStatistics();
auto total = stats.submitted;
auto stats = GetStatistics();
auto total = stats.submitted;
std::ostringstream status_output;
spdlog::debug("┌─────────────────────────────────────────┐");
spdlog::debug(" {} Status │", kLogTag);
spdlog::debug("├─────────────────────────────────────────┤");
spdlog::debug("│ Running │ {:>8} │ {:>6.1f}% │", stats.running, total > 0 ? (stats.running * 100.0 / total) : 0);
spdlog::debug("│ Submitted │ {:>8} │", stats.submitted);
spdlog::debug("│ Completed │ {:>8} │ {:>6.1f}% │", stats.completed, total > 0 ? (stats.completed * 100.0 / total) : 0);
spdlog::debug("│ Failed │ {:>8} │ {:>6.1f}% │", stats.failed, total > 0 ? (stats.failed * 100.0 / total) : 0);
spdlog::debug("│ Cancelled │ {:>8} │ {:>6.1f}%", stats.cancelled, total > 0 ? (stats.cancelled * 100.0 / total) : 0);
if (stats.running > 0)
{
spdlog::debug("├─────────────────────────────────────────┤");
spdlog::debug("Active Tasks");
spdlog::debug("├─────────────────────────────────────────┤");
std::lock_guard lock(mutex_);
for (const auto& [id, context] : running_tasks_)
{
auto runtime = GetElapsedTime(context->start_time);
auto status = context->cancelled.load() ? "CANCEL" : "ACTIVE";
spdlog::debug("│ {:>6} │ {:>12} │ {:>8} │", status, id.substr(0, 12), FormatDuration(runtime));
}
status_output << "\n";
status_output << " ╭────────────────────────────────────────────╮\n";
status_output << " │ 🔔 Request Scheduler Dashboard │\n";
status_output << " ├────────────────────────────────────────────┤\n";
status_output << "\n";
status_output << " │ 📊 SYSTEM METRICS │\n";
status_output << " │ ────────────────────────────────────── │\n";
status_output << fmt::format(" │ 📤 Submitted ▶ {:>6} total \n", stats.submitted);
status_output << fmt::format(" │ 🚀 Running ▶ {:>6} tasks ({:>5.1f}%) │\n", stats.running, total > 0 ? (stats.running * 100.0 / total) : 0);
status_output << fmt::format(" │ ✅ Completed ▶ {:>6} tasks ({:>5.1f}%) │\n", stats.completed, total > 0 ? (stats.completed * 100.0 / total) : 0);
status_output << fmt::format(" │ ❌ Failed ▶ {:>6} tasks ({:>5.1f}%) │\n", stats.failed, total > 0 ? (stats.failed * 100.0 / total) : 0);
status_output << fmt::format(" │ 🥏 Cancelled ▶ {:>6} tasks ({:>5.1f}%) │\n", stats.cancelled, total > 0 ? (stats.cancelled * 100.0 / total) : 0);
status_output << " \n";
if (stats.running > 0) {
status_output << " │ 🎯 ACTIVE TASKS │\n";
status_output << " │ ────────────────────────────────────── │\n";
std::lock_guard lock(mutex_);
for (const auto& [id, context] : running_tasks_) {
auto runtime = GetElapsedTime(context->start_time);
auto status_icon = context->cancelled.load() ? "🔴" : "🟢";
auto short_id = id.length() > 20 ? id.substr(0, 20) + "" : id;
status_output << fmt::format(" │ {} │ {:22} │ ⏱️ {:<8}│\n", status_icon, short_id, FormatDuration(runtime));
}
spdlog::debug("└─────────────────────────────────────────┘");
}
status_output << " ╰────────────────────────────────────────────╯";
spdlog::debug("{}", status_output.str());
}
}
-1
View File
@@ -1,4 +1,3 @@
// request_scheduler.hpp
#pragma once
#include <atomic>
#include <functional>