编写 GUI 来显示统计信息

发布于 2024-11-12 05:51:02 字数 1320 浏览 4 评论 0原文

我正在为一个项目使用硬件模拟器。它最后以一种非常结构化但丑陋的方式输出统计数据。阅读起来可能会很烦人,所以我想编写一个 GUI 来帮助我更好地显示它。有人知道我可以使用什么框架和小部件来快速、轻松地构建干净的东西吗?我希望能够导航树的子节点并隐藏(折叠)我不感兴趣的节点。

统计输出采用这样的形式


root {
 foo = "bar";
 foo_num = 1;
 machine {
  core0 {
   fetch {
    renamed {
      none = 13559;
      flags = 3013;
      reg_and_flags = 10735;
      reg = 8430;
    }
     width[5] = {
      Minimum:                   381
      Maximum:                 17450
      Average:                 1.248
      Total Sum:               28627
      Weighted Sum:            35737
      Threshold:                   3
      [ 61.0% ] [ 61.0% ]     0     0 17450 ******************************
      [  1.3% ] [ 62.3% ]     1     1   381 
      [ 12.1% ] [ 74.4% ]     2     2  3476 ******
      [  3.1% ] [ 77.5% ]     3     3   876 *
      [ 22.5% ] [  100% ]     4     4  6444 ***********
    };
     status (total 57920) {
      [  0.0% ] rob_full = 0; { (zero) }
      [ 35.9% ] ldq_full = 20789;
      [  2.4% ] fetchq_empty = 1394;
      [  0.0% ] physregs_full = 0; { (zero) }
      [ 61.7% ] complete = 35737;
      [  0.0% ] stq_full = 0; { (zero) }
     }
   }
 }
}

已经有一个解析器可以从二进制文件创建一种树,它是用 C++ 编写的,因此选择这种语言的框架也许会更好。另一种方法是生成 XML 输出,然后使用另一种语言来处理信息。

我对可视化编程不是很有经验,而且我真的不知道有哪些类型的小部件可用。任何建议和指示将不胜感激。

I'm working with a hardware simulator for a project. It outputs statistics at the end in a very structured but ugly way. It can be tiresome to read so I would like to write a GUI to help me display it better. Would anybody have an idea of what framework and widgets I could use to quickly and painlessly construct something clean? I would like to be able to navigate the subnodes of the tree and hide (collapse) nodes I'm not interested in.

The statistics output take a form like this


root {
 foo = "bar";
 foo_num = 1;
 machine {
  core0 {
   fetch {
    renamed {
      none = 13559;
      flags = 3013;
      reg_and_flags = 10735;
      reg = 8430;
    }
     width[5] = {
      Minimum:                   381
      Maximum:                 17450
      Average:                 1.248
      Total Sum:               28627
      Weighted Sum:            35737
      Threshold:                   3
      [ 61.0% ] [ 61.0% ]     0     0 17450 ******************************
      [  1.3% ] [ 62.3% ]     1     1   381 
      [ 12.1% ] [ 74.4% ]     2     2  3476 ******
      [  3.1% ] [ 77.5% ]     3     3   876 *
      [ 22.5% ] [  100% ]     4     4  6444 ***********
    };
     status (total 57920) {
      [  0.0% ] rob_full = 0; { (zero) }
      [ 35.9% ] ldq_full = 20789;
      [  2.4% ] fetchq_empty = 1394;
      [  0.0% ] physregs_full = 0; { (zero) }
      [ 61.7% ] complete = 35737;
      [  0.0% ] stq_full = 0; { (zero) }
     }
   }
 }
}

There is already a parser that creates a kind of tree from a binary file, it is written in C++ so perhaps it is better if a choose a framework for this language. An alternative would be to generate XML output and then use another language to process the information.

I'm not very experienced with visual programming and I don't really know what kind of widgets are available. Any suggestions and pointers would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情深缘浅 2024-11-19 05:51:02

当我只是想显示一些信息,并且并不真正需要交互时,有时我会让程序输出一个简单的 html 页面。处理表格和图像(几乎任何格式)之类的事情既快速又简单。如果您需要图表,可以使用网络 API,例如 Google 的图表 API

When I'm just trying to display some information, and I don't really need interaction, I sometimes make the program output a simple html page. It's fast and trivial to do things like tables and images (in virtually any format). If you need graphs, there are web-APIs like Google's chart API.

梦行七里 2024-11-19 05:51:02

我建议使用 boost::spirit::qi 进行解析,使用 Qt + QWT - 用于图形。它们都是C++。 QWT(基于Qt)具有多个开箱即用的便捷图形小部件。

精神: http://www.boost .org/doc/libs/1_46_0/libs/spirit/doc/html/spirit/introduction.html
Qt:http://qt.nokia.com/products
QWT: http://qwt.sourceforge.net/

编辑

更具体地说:< br>
树视图: http://doc.qt.nokia.com/latest/qtreeview.html< /a>
直方图:
http://qwt.sourceforge.net/class_qwt_plot_histogram.html

使用起来非常简单,查看示例以了解具体是如何完成的。

I'd recommend boost::spirit::qi for parsing, and Qt + QWT - for graphics. They are all C++. QWT (which is based on Qt) has multiple convenient graph widgets out of the box.

spirit: http://www.boost.org/doc/libs/1_46_0/libs/spirit/doc/html/spirit/introduction.html
Qt: http://qt.nokia.com/products
QWT: http://qwt.sourceforge.net/

EDIT

More specifically:
Tree view: http://doc.qt.nokia.com/latest/qtreeview.html
Histograms: http://qwt.sourceforge.net/class_qwt_plot_histogram.html

It's all pretty simple to use, check out the samples to find out exactly how is it done.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文