File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\hudson\model\OverallLoadStatistics.java.html

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 package hudson.model;
25
26 import hudson.model.MultiStageTimeSeries.TimeScale;
27 import hudson.model.MultiStageTimeSeries.TrendChart;
28 import jenkins.model.Jenkins;
29 import org.kohsuke.accmod.Restricted;
30 import org.kohsuke.accmod.restrictions.NoExternalUse;
31 import org.kohsuke.stapler.export.Exported;
32
33 /**
34 * {@link LoadStatistics} for the entire system (the master and all the slaves combined),
35 * and all the jobs that are running on it.
36 *
37 * @author Kohsuke Kawaguchi
38 * @see Jenkins#overallLoad
39 * @see UnlabeldLoadStatistics
40 */
41 public class OverallLoadStatistics extends LoadStatistics {
42 /**
43 * Number of total {@link Queue.BuildableItem}s that represents blocked builds.
44 *
45 * @deprecated as of 1.467
46 * Use {@link #queueLength}. Left as an alias here for backward compatibility.
47 */
48 @Exported
49 @Restricted(NoExternalUse.class)
50 public final MultiStageTimeSeries totalQueueLength = queueLength;
51
52 public OverallLoadStatistics() {
53 super(0,0);
54 }
55
56 @Override
57 public int computeIdleExecutors() {
58 return new ComputerSet().getIdleExecutors();
59 }
60
61 @Override
62 public int computeTotalExecutors() {
63 return new ComputerSet().getTotalExecutors();
64 }
65
66 @Override
67 public int computeQueueLength() {
68 return Jenkins.getInstance().getQueue().countBuildableItems();
69 }
70
71 /**
72 * When drawing the overall load statistics, use the total queue length,
73 * not {@link #queueLength}, which just shows jobs that are to be run on the master.
74 */
75 protected TrendChart createOverallTrendChart(TimeScale timeScale) {
76 return MultiStageTimeSeries.createTrendChart(timeScale,busyExecutors,totalExecutors,queueLength);
77 }
78 }
79