如何从 perf4j 日志文件制作图表?

发布于 2024-08-25 07:16:30 字数 78 浏览 2 评论 0原文

我使用perf4j来计算进程的性能。现在我想为该文件制作图表。是否可以在不使用 Google API 或任何其他可以使用的方法的情况下实现它?

I have used perf4j to calculate the performance of the process. Now I want to make the graph for that file. Is it possible to make it without using Google API or any other method that can be used?

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

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

发布评论

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

评论(3

老子叫无熙 2024-09-01 07:16:30

您有几个选择:

  1. 当您使用 org.perf4j.LogParser 解析日志时,您可以使用“--format csv”选项生成 CSV 输出,在 Excel 中打开它,然后在 Excel 中创建图表。
  2. 正如另一位发帖者所说,我不确定您为什么反对使用 Google Chart API,但如果您坚决反对使用它,请注意 JFreeChart 人员提供了一个名为 Eastwood Charts 的 Google Chart API 实现:< a href="http://www.jfree.org/eastwood/" rel="noreferrer">http://www.jfree.org/eastwood/。您可以仅设置 eastwood 服务器,然后设置代理(或仅在主机文件中设置)chart.apis.google 。 com 到您的伊斯特伍德服务器。或者,如果您查看 org.perf4j.LogParser 类,则可以重写 newMeanTimeChartGenerator 和 newTpsChartGenerator 方法来调用采用基本 URL 的 GoogleChartGenerator 构造函数。
  3. 您始终可以创建StatisticsChartGenerator 接口的另一个实现并使用它。显然这是最复杂的选项。

You have a couple of options:

  1. When you use the org.perf4j.LogParser to parse your log, you can use the "--format csv" option to generate CSV output, open this up in Excel, then create a graph in Excel.
  2. As the other poster said, I'm not sure why you're against using the Google Chart API, but if you are dead set against using it, note that the JFreeChart guys provide an implementation of the Google Chart APIs called Eastwood Charts: http://www.jfree.org/eastwood/. You could just set up an eastwood server and then proxy (or just set up in a hosts file) chart.apis.google . com to your eastwood server. Alternatively, if you look at the org.perf4j.LogParser class, you can override the newMeanTimeChartGenerator and newTpsChartGenerator methods to call the GoogleChartGenerator constructor that takes the base URL.
  3. You can always create another implementation of the StatisticsChartGenerator interface and use this instead. Obviously this is the most involved option.
鱼忆七猫命九 2024-09-01 07:16:30

你能多解释一下为什么你想避免使用 Google Charting API(我问这个问题是因为我很好奇为什么有人不想做一些非常简单、优雅和免费的事情)?

还有一个 GraphingServlet 部分“在 Web 应用程序中公开性能图”,我认为内部确实如此同样的事情。

如果您仍然想要,可以获取图形数据(原始 csv 格式)并编写一些帮助程序类以使用 jfreechart(富客户端)等库创建图表

Can you explain a bit more as to why you want to avoid Google Charting APIs (I ask since I am intrigued as to why someone would not want to do something that is very simple, elegant and FREE)?

Also there is a GraphingServlet section "Exposing Performance Graphs in a Web Application" which I think internally does the same thing.

If you still want you can take the graph data (in raw csv format) and write some helper classes to create charts using libraries like jfreechart (rich client)

过度放纵 2024-09-01 07:16:30

请按照以下步骤操作;

  1. 转到 perf4j 日志文件所在的位置并在其中打开命令提示符。
  2. 在 cmd 中输入以下命令,确保在此位置将 java(jdk) 路径设置为环境变量和 perf4j jar:

java -jar perf4j-0.9.16.jar --graph perfGraphs.html perfLogFile.log

这将生成 perfGraphs .html 文件位于此位置,其中包含图表。

follow the following steps;

  1. Go to the location where your perf4j log file exits and open command prompt there.
  2. Hit the following command in cmd, make sure you have java(jdk) path set as environment variable and perf4j jar on this location:

java -jar perf4j-0.9.16.jar --graph perfGraphs.html perfLogFile.log

this will generate perfGraphs.html file in this location, which consists of graphs.

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