kernel-shark-qt: Re-enable the Graph plot example
This patch re-enables the compilation of the Graph plotting example
after making it compatible with the new version of the C API.
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
diff --git a/kernel-shark/examples/CMakeLists.txt b/kernel-shark/examples/CMakeLists.txt
index 8b9c4cd..0b18e54 100644
--- a/kernel-shark/examples/CMakeLists.txt
+++ b/kernel-shark/examples/CMakeLists.txt
@@ -16,10 +16,10 @@
add_executable(confio configio.c)
target_link_libraries(confio kshark)
-# message(STATUS "dataplot")
-# add_executable(dplot dataplot.cpp)
-# target_link_libraries(dplot kshark-plot)
-#
+message(STATUS "dataplot")
+add_executable(dplot dataplot.cpp)
+target_link_libraries(dplot kshark-plot)
+
# message(STATUS "widgetdemo")
# add_executable(widgetdemo widgetdemo.cpp)
# target_link_libraries(widgetdemo kshark-gui)
diff --git a/kernel-shark/examples/dataplot.cpp b/kernel-shark/examples/dataplot.cpp
index 94841e7..1b32a4c 100644
--- a/kernel-shark/examples/dataplot.cpp
+++ b/kernel-shark/examples/dataplot.cpp
@@ -29,6 +29,7 @@
struct kshark_trace_histo histo;
vector<KsPlot::Graph *> graphs;
+int stream_id;
void usage(const char *prog)
{
@@ -117,10 +118,10 @@
it = graphs.begin();
for (int const &cpu: CPUs)
- (*it++)->fillCPUGraph(cpu);
+ (*it++)->fillCPUGraph(stream_id, cpu);
for (int const &pid: Tasks)
- (*it++)->fillTaskGraph(pid);
+ (*it++)->fillTaskGraph(stream_id, pid);
/* Clear the screen. */
glClear(GL_COLOR_BUFFER_BIT);
@@ -146,7 +147,7 @@
struct kshark_context *kshark_ctx(nullptr);
struct kshark_entry **data(nullptr);
static char *input_file(nullptr);
- bool status, shapes(false);
+ bool shapes(false);
size_t r, nRows;
int c, nBins;
@@ -191,8 +192,8 @@
if (!input_file)
input_file = default_file;
- status = kshark_open(kshark_ctx, input_file);
- if (!status) {
+ stream_id = kshark_open(kshark_ctx, input_file);
+ if (stream_id < 0) {
kshark_free(kshark_ctx);
usage(argv[0]);
cerr << "\nFailed to open file " << input_file << endl;
@@ -201,7 +202,7 @@
}
/* Load the content of the file into an array of entries. */
- nRows = kshark_load_data_entries(kshark_ctx, &data);
+ nRows = kshark_load_data_entries(kshark_ctx, stream_id, &data);
/* Initialize the Visualization Model. */
ksmodel_init(&histo);
@@ -228,7 +229,7 @@
ksmodel_clear(&histo);
/* Close the file. */
- kshark_close(kshark_ctx);
+ kshark_close(kshark_ctx, stream_id);
/* Close the session. */
kshark_free(kshark_ctx);