Files
2024-02-16 14:38:01 +01:00

51 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Core
{
public class ExecStats
{
/// <summary>
/// Numero chiamate registrate
/// </summary>
public int NumCall { get; set; } = 0;
/// <summary>
/// Durata totale chiamate
/// </summary>
public TimeSpan TotalTime { get; set; } = new TimeSpan(0, 0, 0);
/// <summary>
/// Tempo medio (calcolato)
/// </summary>
[NotMapped]
public TimeSpan AvgTime
{
get
{
TimeSpan answ = TotalTime;
if (NumCall > 1)
{
answ = TotalTime / NumCall;
}
return answ;
}
}
/// <summary>
/// Init classe
/// </summary>
/// <param name="numCall"></param>
/// <param name="duration"></param>
public ExecStats(int numCall, TimeSpan duration)
{
this.NumCall = numCall;
this.TotalTime = duration;
}
}
}