提交 31fd0c97 编写于 作者: J Jesse Glick

Remote class loading statistics.

上级 1f94f6ef
......@@ -64,6 +64,8 @@ Upcoming changes</a>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15889">issue 15889</a>)
<li class=rfe>
When using container-managed security, display unprotected root actions in the configuration screen for convenience.
<li class=rfe>
Display class loading statistics in <code>/computer/<i>name</i>/systemInfo</code>.
<li class=rfe>
Added <tt>list-plugins</tt> CLI command.
</ul>
......
......@@ -316,6 +316,60 @@ public class SlaveComputer extends Computer {
setChannel(channel,launchLog,listener);
}
/**
* Shows {@link Channel#classLoadingCount}.
* @since 1.495
*/
public int getClassLoadingCount() throws IOException, InterruptedException {
return channel.call(new LoadingCount(false));
}
/**
* Shows {@link Channel#resourceLoadingCount}.
* @since 1.495
*/
public int getResourceLoadingCount() throws IOException, InterruptedException {
return channel.call(new LoadingCount(true));
}
/**
* Shows {@link Channel#classLoadingTime}.
* @since 1.495
*/
public long getClassLoadingTime() throws IOException, InterruptedException {
return channel.call(new LoadingTime(false));
}
/**
* Shows {@link Channel#resourceLoadingTime}.
* @since 1.495
*/
public long getResourceLoadingTime() throws IOException, InterruptedException {
return channel.call(new LoadingTime(true));
}
static class LoadingCount implements Callable<Integer,RuntimeException> {
private final boolean resource;
LoadingCount(boolean resource) {
this.resource = resource;
}
@Override public Integer call() {
Channel c = Channel.current();
return resource ? c.resourceLoadingCount.get() : c.classLoadingCount.get();
}
}
static class LoadingTime implements Callable<Long,RuntimeException> {
private final boolean resource;
LoadingTime(boolean resource) {
this.resource = resource;
}
@Override public Long call() {
Channel c = Channel.current();
return resource ? c.resourceLoadingTime.get() : c.classLoadingTime.get();
}
}
/**
* Sets up the connection through an exsting channel.
*
......
h1(_('Remote Class Loader Statistics'))
def fmt = new java.text.DecimalFormat("0.0")
def right = 'text-align: right'
table(class: 'bigtable') {
tr {
th _('Loading Type')
th _('Time (s)')
th _('Count')
}
tr {
td _('Classes')
td(style: right) {text(fmt.format(my.classLoadingTime / 1000000000))}
td(style: right) {text(my.classLoadingCount)}
}
tr {
td _('Resources')
td(style: right) {text(fmt.format(my.resourceLoadingTime / 1000000000))}
td(style: right) {text(my.resourceLoadingCount)}
}
}
......@@ -44,6 +44,9 @@ THE SOFTWARE.
<h2>${t.key}</h2>
<pre>${t.value}</pre>
</j:forEach>
<j:if test="${it.channel != null}">
<st:include page="statistics.groovy"/>
</j:if>
</l:hasPermission>
</l:main-panel>
</l:layout>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册