增加API方法调用耗时统计

This commit is contained in:
刘祥超
2022-01-19 16:53:38 +08:00
parent 79e52d1c6e
commit 65d19d92e9
6 changed files with 142 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
<first-menu>
<a href="" class="item" @click.prevent="createNode()">[添加节点]</a>
<a href="/api/methodStats" class="item" v-if="hasMethodStats">用时统计</a>
</first-menu>
<p class="comment" v-if="nodes.length == 0">暂时还没有节点。</p>

View File

@@ -0,0 +1,46 @@
{$layout}
<div class="margin"></div>
<form method="get" action="/api/methodStats" class="ui form">
<div class="ui fields inline">
<div class="ui field">
<input type="text" name="method" v-model="method" placeholder="方法"/>
</div>
<div class="ui field">
<input type="text" name="tag" v-model="tag" placeholder="标签"/>
</div>
<div class="ui field">
<select class="ui dropdown auto-width" name="order" v-model="order">
<option value="">[排序]</option>
<option value="method">方法</option>
<option value="costMs.desc">平均耗时</option>
<option value="peekMs.desc">峰值耗时</option>
<option value="calls.desc">调用次数</option>
</select>
</div>
<div class="ui field">
<button class="ui button" type="submit">搜索</button>
&nbsp;
<a href="/api/methodStats" v-if="method.length > 0 || tag.length > 0 || order.length > 0">清除条件</a>
</div>
</div>
</form>
<table class="ui table selectable celled">
<thead>
<tr>
<th>方法</th>
<th>标签</th>
<th>平均耗时</th>
<th>峰值耗时</th>
<td>调用次数</td>
</tr>
</thead>
<tr v-for="stat in stats">
<td>{{stat.method}}</td>
<td>{{stat.tag}}</td>
<td>{{stat.costMs}}ms</td>
<td>{{stat.peekMs}}ms</td>
<td>{{stat.countCalls}}次</td>
</tr>
</table>