类型重命名
This commit is contained in:
parent
e478f0855c
commit
df017ed29c
@ -65,10 +65,10 @@ namespace FastGithub.FlowAnalyze
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取速率
|
||||
/// 获取流量分析
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public FlowRate GetFlowRate()
|
||||
public FlowStatistics GetFlowStatistics()
|
||||
{
|
||||
Flush(this.readQueue);
|
||||
var readRate = (double)this.readQueue.Sum(item => item.Length) / INTERVAL_SECONDS;
|
||||
@ -76,7 +76,7 @@ namespace FastGithub.FlowAnalyze
|
||||
Flush(this.writeQueue);
|
||||
var writeRate = (double)this.writeQueue.Sum(item => item.Length) / INTERVAL_SECONDS;
|
||||
|
||||
return new FlowRate
|
||||
return new FlowStatistics
|
||||
{
|
||||
TotalRead = this.totalRead,
|
||||
TotalWrite = this.totalWrite,
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
namespace FastGithub.FlowAnalyze
|
||||
{
|
||||
public record FlowRate
|
||||
/// <summary>
|
||||
/// 流量统计
|
||||
/// </summary>
|
||||
public record FlowStatistics
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取总读上行
|
||||
@ -12,8 +15,14 @@
|
||||
/// </summary>
|
||||
public long TotalWrite { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取读取速率
|
||||
/// </summary>
|
||||
public double ReadRate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取写入速率
|
||||
/// </summary>
|
||||
public double WriteRate { get; init; }
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,6 @@
|
||||
/// 获取速率
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
FlowRate GetFlowRate();
|
||||
FlowStatistics GetFlowStatistics();
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FlowRate.cs" />
|
||||
<Compile Include="FlowStatistics.cs" />
|
||||
<Compile Include="FlowChart.xaml.cs">
|
||||
<DependentUpon>FlowChart.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@ -31,7 +31,7 @@ namespace FastGithub.UI
|
||||
|
||||
public List<string> Labels { get; } = new List<string>();
|
||||
|
||||
public Func<double, string> YFormatter { get; } = value => $"{FlowRate.ToNetworkSizeString((long)value)}/s";
|
||||
public Func<double, string> YFormatter { get; } = value => $"{FlowStatistics.ToNetworkSizeString((long)value)}/s";
|
||||
|
||||
public FlowChart()
|
||||
{
|
||||
@ -51,7 +51,7 @@ namespace FastGithub.UI
|
||||
{
|
||||
try
|
||||
{
|
||||
await this.GetFlowRateAsync(httpClient);
|
||||
await this.GetFlowStatisticsAsync(httpClient);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@ -63,17 +63,17 @@ namespace FastGithub.UI
|
||||
}
|
||||
}
|
||||
|
||||
private async Task GetFlowRateAsync(HttpClient httpClient)
|
||||
private async Task GetFlowStatisticsAsync(HttpClient httpClient)
|
||||
{
|
||||
var response = await httpClient.GetAsync("http://127.0.0.1/flowRates");
|
||||
var response = await httpClient.GetAsync("http://127.0.0.1/flowStatistics");
|
||||
var json = await response.EnsureSuccessStatusCode().Content.ReadAsStringAsync();
|
||||
var flowRate = Newtonsoft.Json.JsonConvert.DeserializeObject<FlowRate>(json);
|
||||
var flowStatistics = Newtonsoft.Json.JsonConvert.DeserializeObject<FlowStatistics>(json);
|
||||
|
||||
this.textBlockRead.Text = FlowRate.ToNetworkSizeString(flowRate.TotalRead);
|
||||
this.textBlockWrite.Text = FlowRate.ToNetworkSizeString(flowRate.TotalWrite);
|
||||
this.textBlockRead.Text = FlowStatistics.ToNetworkSizeString(flowStatistics.TotalRead);
|
||||
this.textBlockWrite.Text = FlowStatistics.ToNetworkSizeString(flowStatistics.TotalWrite);
|
||||
|
||||
this.readSeries.Values.Add(flowRate.ReadRate);
|
||||
this.writeSeries.Values.Add(flowRate.WriteRate);
|
||||
this.readSeries.Values.Add(flowStatistics.ReadRate);
|
||||
this.writeSeries.Values.Add(flowStatistics.WriteRate);
|
||||
this.Labels.Add(DateTime.Now.ToString("HH:mm:ss"));
|
||||
|
||||
if (this.Labels.Count > 60)
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
namespace FastGithub.UI
|
||||
{
|
||||
public class FlowRate
|
||||
/// <summary>
|
||||
/// 流量统计
|
||||
/// </summary>
|
||||
public class FlowStatistics
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取总读上行
|
||||
@ -12,8 +15,14 @@
|
||||
/// </summary>
|
||||
public long TotalWrite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取上行速率
|
||||
/// </summary>
|
||||
public double ReadRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取下行速率
|
||||
/// </summary>
|
||||
public double WriteRate { get; set; }
|
||||
|
||||
|
||||
@ -68,15 +68,15 @@ namespace FastGithub
|
||||
appBuilder.UseRouting();
|
||||
appBuilder.UseEndpoints(endpoint =>
|
||||
{
|
||||
endpoint.MapGet("/flowRates", context =>
|
||||
endpoint.MapGet("/flowStatistics", context =>
|
||||
{
|
||||
var loggingFeature = context.Features.Get<IRequestLoggingFeature>();
|
||||
if (loggingFeature != null)
|
||||
{
|
||||
loggingFeature.Enable = false;
|
||||
}
|
||||
var flowRate = context.RequestServices.GetRequiredService<IFlowAnalyzer>().GetFlowRate();
|
||||
return context.Response.WriteAsJsonAsync(flowRate);
|
||||
var flowStatistics = context.RequestServices.GetRequiredService<IFlowAnalyzer>().GetFlowStatistics();
|
||||
return context.Response.WriteAsJsonAsync(flowStatistics);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -376,9 +376,7 @@ code {
|
||||
<h3 id="2-%E9%83%A8%E7%BD%B2%E6%96%B9%E5%BC%8F">2 部署方式</h3>
|
||||
<h4 id="21-windows-x64">2.1 windows-x64</h4>
|
||||
<ul>
|
||||
<li>双击运行fastgithub.exe程序</li>
|
||||
<li><code>fastgithub.exe start</code> // 以windows服务安装并启动</li>
|
||||
<li><code>fastgithub.exe stop</code> // 以windows服务卸载并删除</li>
|
||||
<li>双击运行FastGithub.UI.exe</li>
|
||||
</ul>
|
||||
<h4 id="22-linux-x64">2.2 linux-x64</h4>
|
||||
<ul>
|
||||
@ -388,7 +386,7 @@ code {
|
||||
</ul>
|
||||
<h4 id="23-macos-x64">2.3 macOS-x64</h4>
|
||||
<ul>
|
||||
<li>双击运行fastgithub程序</li>
|
||||
<li>双击运行fastgithub</li>
|
||||
<li>安装cacert/fastgithub.cer并设置信任</li>
|
||||
<li>设置系统自动代理为<code>http://127.0.0.1:38457</code>,或手动代理http/https为<code>127.0.0.1:38457</code></li>
|
||||
<li><a href="https://github.com/dotnetcore/FastGithub/blob/master/MacOSXConfig.md">具体配置详情</a></li>
|
||||
|
||||
@ -8,9 +8,7 @@ github加速神器,解决github打不开、用户头像无法加载、releases
|
||||
|
||||
### 2 部署方式
|
||||
#### 2.1 windows-x64
|
||||
* 双击运行fastgithub.exe程序
|
||||
* `fastgithub.exe start` // 以windows服务安装并启动
|
||||
* `fastgithub.exe stop` // 以windows服务卸载并删除
|
||||
* 双击运行FastGithub.UI.exe
|
||||
|
||||
#### 2.2 linux-x64
|
||||
* 执行`./fastgithub`
|
||||
@ -18,7 +16,7 @@ github加速神器,解决github打不开、用户头像无法加载、releases
|
||||
* 设置系统自动代理为`http://127.0.0.1:38457`,或手动代理http/https为`127.0.0.1:38457`
|
||||
|
||||
#### 2.3 macOS-x64
|
||||
* 双击运行fastgithub程序
|
||||
* 双击运行fastgithub
|
||||
* 安装cacert/fastgithub.cer并设置信任
|
||||
* 设置系统自动代理为`http://127.0.0.1:38457`,或手动代理http/https为`127.0.0.1:38457`
|
||||
* [具体配置详情](https://github.com/dotnetcore/FastGithub/blob/master/MacOSXConfig.md)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user