commit cb81debff5d751f5bc631efcce862cdccda3a70f
Author: Marcos Assuncao <assuncao@acm.org>
Date:   Mon Aug 25 15:49:17 2014 +0200

    added new graph

diff --git a/papers/2014/kwapi/experiments/data/cpu_usage.txt b/papers/2014/kwapi/experiments/data/cpu_usage.txt
deleted file mode 100644
index 52e1b24..0000000
--- a/papers/2014/kwapi/experiments/data/cpu_usage.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Scenarios,Driver,API,API+1 req/s
-IPMI cards signed,27,16,20
-PDUs signed,26,16,20
-IPMI cards unsigned,20,12,16
-PDUs unsigned,11,9,13
\ No newline at end of file
diff --git a/papers/2014/kwapi/experiments/data/cpu_usage_api.txt b/papers/2014/kwapi/experiments/data/cpu_usage_api.txt
new file mode 100644
index 0000000..52e1b24
--- /dev/null
+++ b/papers/2014/kwapi/experiments/data/cpu_usage_api.txt
@@ -0,0 +1,5 @@
+Scenarios,Driver,API,API+1 req/s
+IPMI cards signed,27,16,20
+PDUs signed,26,16,20
+IPMI cards unsigned,20,12,16
+PDUs unsigned,11,9,13
\ No newline at end of file
diff --git a/papers/2014/kwapi/experiments/src/python/lib/graph.py b/papers/2014/kwapi/experiments/src/python/lib/graph.py
index 3f9b3c4..4ebe975 100644
--- a/papers/2014/kwapi/experiments/src/python/lib/graph.py
+++ b/papers/2014/kwapi/experiments/src/python/lib/graph.py
@@ -84,6 +84,65 @@ def cpu_graph(input_dir, output_dir):
     # plt.show()
     plt.savefig(output_dir + '/cpu_usage_driver.pdf')
 
+def api_graph(input_dir, output_dir):
+    print("Creating API CPU usage graph...")
+
+    inf = open(input_dir + '/cpu_usage_api.txt', 'r')
+    lines = inf.readlines()
+    inf.close()
+
+    figure(figsize=(7, 4))
+    ax = plt.subplot(111)
+    # fig, ax = plt.subplots()
+
+    width = 0.35  # the width of the bars
+    first_line = True
+    count = 0
+    api = []
+    apireq = []
+    xticks = []
+    for line in lines:
+        elems = line.split(',')
+        if first_line:
+            first_line = False
+            continue
+
+        xticks.append(elems[0])
+        api.append(int(elems[1]))
+        apireq.append(int(elems[2]))
+
+    opacity = 0.5
+    N = 4
+    ind = [float(0),float(2),float(4),float(6)]
+    ind2 = [float(0.8),float(2.8),float(4.8),float(6.8)]
+    indt = [float(0.8),float(2.8),float(4.8),float(6.8)]
+    #print ind + width
+    colors = ['r','b','g','y']
+    # bars = ax.bar(ind + width / 2, values, width=width, color=colors, alpha=opacity)
+    bars_api = ax.barh(ind, api, color='r', alpha=opacity)
+    bars_apireq = ax.barh(ind2, apireq, color='b', alpha=opacity)
+    plt.yticks(indt, ('IPMI cards\nsigned', 'PDUs\nsigned', 'IPMI cards\nunsigned', 'PDUs\nunsigned'))
+
+    # colors = np.linspace(0, 1, len(bars))
+
+    # for bar in bars:
+
+    # plt.tick_params(
+    #     axis='y',          # changes apply to the y-axis
+    #     which='both',      # both major and minor ticks are affected
+    #     bottom='off',      # ticks along the bottom edge are off
+    #     top='off',         # ticks along the top edge are off
+    #     labelbottom='off') # labels along the bottom edge are off
+
+    # plt.ylabel('Scenarios')
+    plt.xlabel('CPU Usage (\%)')
+    # plt.title('CPU Usage of Drivers Under Different Scenarios')
+    plt.legend((bars_api, bars_apireq), ['REST API only', 'REST API + 1 req./s'])
+
+    plt.tight_layout()
+    #plt.show()
+    plt.savefig(output_dir + '/cpu_usage_api.pdf')
+
 def network_graph(input_dir, output_dir):
     print("Creating network usage graph...")
 
@@ -218,6 +277,7 @@ def throughput_graph(input_dir, output_dir):
 def plot_graphs():
     args = parse_arguments()
     print("Creating the graphs...")
-    cpu_graph(args.input_dir, args.output_dir)
+    #cpu_graph(args.input_dir, args.output_dir)
+    api_graph(args.input_dir, args.output_dir)
     #network_graph(args.input_dir, args.output_dir)
     # throughput_graph(args.input_dir, args.output_dir)
diff --git a/papers/2014/kwapi/figs/cpu_usage_api.pdf b/papers/2014/kwapi/figs/cpu_usage_api.pdf
new file mode 100644
index 0000000..da2a4d0
Binary files /dev/null and b/papers/2014/kwapi/figs/cpu_usage_api.pdf differ
diff --git a/papers/2014/kwapi/paper.tex b/papers/2014/kwapi/paper.tex
index 4d04f5e..37586f2 100755
--- a/papers/2014/kwapi/paper.tex
+++ b/papers/2014/kwapi/paper.tex
@@ -276,6 +276,15 @@ Figure~\ref{fig:cpu_usage} shows the results of CPU usage of drivers under the e
 \label{fig:cpu_usage}
 \end{figure}
 
+We also evaluated the CPU consumption of the REST API data consumer under the scenarios described in Table \ref{tab:parameters_usage}. In addition to these scenarios, two conditions were assessed, namely (i) the REST API working as a consumer requesting data from drivers at a one-second time interval (REST API only); and (ii) the API requesting data at one-second interval and also answering a call every second to provide the collected data to an external system (REST API + 1 req/s). Figure \ref{fig:cpu_usage_consumer} summarises the obtained results. The CPU consumption is in general low, and even when message signing is enabled and the API serves a query, its consumption is below 20\%. The small variation between the scenarios without message signing is caused by the manner ZeroMQ accumulates data on nodes prior to transmission. 
+
+\begin{figure}[!ht]
+\center
+\includegraphics[width=1.\columnwidth]{figs/cpu_usage_api.pdf}
+\caption{API consumer CPU usage under the evaluated scenarios.}
+\label{fig:cpu_usage_consumer}
+\end{figure}
+
 Although the CPU usage often depends on the drivers, data consumers, and their complexity, and whether message signature is enabled, the experiments show that a large number of probes can be managed by a single machine. In our environment, a management machine per site is more than enough to accommodate the users' monitoring needs. The drivers and API can reuse a machine that already serves other monitoring purposes.
 
 \begin{figure}[!ht]
