blob: 3d9504b164b93fa570348958765b5b17a5d60a60 [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001package net.floodlightcontroller.perfmon;
2
3import java.util.ArrayList;
4import java.util.Collection;
5import java.util.HashMap;
6import java.util.List;
7import java.util.Map;
8
9import org.openflow.protocol.OFMessage;
10
11import net.floodlightcontroller.core.FloodlightContext;
12import net.floodlightcontroller.core.IOFMessageListener;
13import net.floodlightcontroller.core.IOFSwitch;
14import net.floodlightcontroller.core.module.FloodlightModuleContext;
15import net.floodlightcontroller.core.module.FloodlightModuleException;
16import net.floodlightcontroller.core.module.IFloodlightModule;
17import net.floodlightcontroller.core.module.IFloodlightService;
18
19/**
20 * An IPktInProcessingTimeService implementation that does nothing.
21 * This is used mainly for performance testing or if you don't
22 * want to use the IPktInProcessingTimeService features.
23 * @author alexreimers
24 *
25 */
26public class NullPktInProcessingTime
27 implements IFloodlightModule, IPktInProcessingTimeService {
28
29 private CumulativeTimeBucket ctb;
30 private boolean inited = false;
31
32 public Collection<Class<? extends IFloodlightService>> getModuleServices() {
33 Collection<Class<? extends IFloodlightService>> l =
34 new ArrayList<Class<? extends IFloodlightService>>();
35 l.add(IPktInProcessingTimeService.class);
36 return l;
37 }
38
39 @Override
40 public Map<Class<? extends IFloodlightService>, IFloodlightService>
41 getServiceImpls() {
42 Map<Class<? extends IFloodlightService>,
43 IFloodlightService> m =
44 new HashMap<Class<? extends IFloodlightService>,
45 IFloodlightService>();
46 // We are the class that implements the service
47 m.put(IPktInProcessingTimeService.class, this);
48 return m;
49 }
50
51 @Override
52 public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
53 // We don't have any dependencies
54 return null;
55 }
56
57 @Override
58 public void init(FloodlightModuleContext context)
59 throws FloodlightModuleException {
60
61 }
62
63 @Override
64 public void startUp(FloodlightModuleContext context) {
65 // no-op
66 }
67
68 @Override
69 public boolean isEnabled() {
70 return false;
71 }
72
73 @Override
74 public void bootstrap(List<IOFMessageListener> listeners) {
75 if (!inited)
76 ctb = new CumulativeTimeBucket(listeners);
77 }
78
79 @Override
80 public void recordStartTimeComp(IOFMessageListener listener) {
81
82 }
83
84 @Override
85 public void recordEndTimeComp(IOFMessageListener listener) {
86
87 }
88
89 @Override
90 public void recordStartTimePktIn() {
91
92 }
93
94 @Override
95 public void recordEndTimePktIn(IOFSwitch sw, OFMessage m,
96 FloodlightContext cntx) {
97
98 }
99
100 @Override
101 public void setEnabled(boolean enabled) {
102
103 }
104
105 @Override
106 public CumulativeTimeBucket getCtb() {
107 return ctb;
108 }
109}