Asoka.Wang 21f044712c 1
2025-08-27 18:39:19 +08:00

220 lines
5.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
namespace NPP.SmartSchedue.Api.Contracts.Services.Integration.Output
{
/// <summary>
/// 整合性能指标
/// 用于监控和评估整合操作的性能表现
/// </summary>
public class IntegrationPerformanceMetrics
{
/// <summary>
/// 指标收集时间
/// </summary>
public DateTime MetricsTime { get; set; } = DateTime.Now;
/// <summary>
/// 整合记录ID
/// </summary>
public long IntegrationRecordId { get; set; }
/// <summary>
/// 处理任务数量
/// </summary>
public int ProcessedTaskCount { get; set; }
/// <summary>
/// 总处理时间(毫秒)
/// </summary>
public long TotalProcessingTimeMs { get; set; }
/// <summary>
/// 平均单任务处理时间(毫秒)
/// </summary>
public double AverageTaskProcessingTimeMs { get; set; }
/// <summary>
/// 验证总时间(毫秒)
/// </summary>
public long ValidationTimeMs { get; set; }
/// <summary>
/// 分配算法执行时间(毫秒)
/// </summary>
public long AllocationAlgorithmTimeMs { get; set; }
/// <summary>
/// 数据库操作时间(毫秒)
/// </summary>
public long DatabaseOperationTimeMs { get; set; }
/// <summary>
/// 外部服务调用时间(毫秒)
/// </summary>
public long ExternalServiceCallTimeMs { get; set; }
/// <summary>
/// 内存使用量MB
/// </summary>
public long MemoryUsageMB { get; set; }
/// <summary>
/// 成功率(百分比)
/// </summary>
public decimal SuccessRate { get; set; }
/// <summary>
/// 错误次数
/// </summary>
public int ErrorCount { get; set; }
/// <summary>
/// 警告次数
/// </summary>
public int WarningCount { get; set; }
/// <summary>
/// 重试次数
/// </summary>
public int RetryCount { get; set; }
/// <summary>
/// 缓存命中率(百分比)
/// </summary>
public decimal CacheHitRate { get; set; }
/// <summary>
/// 并发处理线程数
/// </summary>
public int ConcurrentThreadCount { get; set; }
/// <summary>
/// 吞吐量(任务/秒)
/// </summary>
public decimal Throughput { get; set; }
/// <summary>
/// 详细性能日志
/// </summary>
public List<PerformanceLogEntry> DetailedLogs { get; set; } = new();
/// <summary>
/// 性能评级
/// </summary>
public PerformanceRating Rating { get; set; }
/// <summary>
/// 性能优化建议
/// </summary>
public List<string> OptimizationSuggestions { get; set; } = new();
/// <summary>
/// 人员公平性评分
/// </summary>
public int PersonnelFairnessScore { get; set; }
/// <summary>
/// 设备利用率
/// </summary>
public decimal EquipmentUtilizationRate { get; set; }
/// <summary>
/// 整体匹配成功率
/// </summary>
public decimal OverallMatchSuccessRate { get; set; }
/// <summary>
/// 平均任务复杂度
/// </summary>
public decimal AverageTaskComplexity { get; set; }
}
/// <summary>
/// 性能日志条目
/// </summary>
public class PerformanceLogEntry
{
/// <summary>
/// 时间戳
/// </summary>
public DateTime Timestamp { get; set; } = DateTime.Now;
/// <summary>
/// 操作名称
/// </summary>
public string OperationName { get; set; }
/// <summary>
/// 执行时间(毫秒)
/// </summary>
public long ExecutionTimeMs { get; set; }
/// <summary>
/// 相关数据
/// </summary>
public Dictionary<string, object> Metadata { get; set; } = new();
/// <summary>
/// 日志级别
/// </summary>
public PerformanceLogLevel Level { get; set; }
}
/// <summary>
/// 性能评级枚举
/// </summary>
public enum PerformanceRating
{
/// <summary>
/// 优秀
/// </summary>
Excellent = 1,
/// <summary>
/// 良好
/// </summary>
Good = 2,
/// <summary>
/// 一般
/// </summary>
Average = 3,
/// <summary>
/// 较差
/// </summary>
Poor = 4,
/// <summary>
/// 差
/// </summary>
Bad = 5
}
/// <summary>
/// 性能日志级别枚举
/// </summary>
public enum PerformanceLogLevel
{
/// <summary>
/// 信息
/// </summary>
Info = 1,
/// <summary>
/// 警告
/// </summary>
Warning = 2,
/// <summary>
/// 错误
/// </summary>
Error = 3,
/// <summary>
/// 关键
/// </summary>
Critical = 4
}
}