有没有收集 Win32 应用程序使用统计信息的工具?

发布于 2024-07-26 06:25:31 字数 114 浏览 5 评论 0原文

有什么工具可以做到这一点吗? 就像一个网站一样,出于相同的基本原因?

更新 - - 我的意思是收集有关我正在编写的应用程序的统计信息 我需要知道哪些选项最常用、何时、次数等。

Is there any tool that can do this? Just like a website and for the same basic reasons?

UPDATE ---
I mean collecting statistics info about an application that I am writing
I need to know what options are used most, when, times, etc.

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

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

发布评论

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

评论(3

最笨的告白 2024-08-02 06:25:31

我过去也做过类似的事情。

我可以想到两种方法来做到这一点。

使用操作:

使用操作时,通过将代码放置在 TAc​​tionList.OnExecute 处理程序中可以非常轻松地跟踪 UI 使用情况。 此事件在执行单个操作之前触发,这使您可以跟踪发生的情况和时间。

例如:

procedure TForm1.ActionList1Execute(Action: TBasicAction; var Handled: Boolean);
begin
   WriteToLog(TAction(TBasicAction).Caption);
end;

不使用操作:

如果您不使用操作,事情会变得有点困难,但并非不可能。 您必须创建一个带有 TMenuItem 后代的新单元,其中包含您的日志记录代码。 确保将新单元放在使用它的每个单元的使用子句中的 MENU 单元之后。 新的后代必须被称为 TMenuItem 才能工作。 因为您本质上是重新引入相同的类,但具有扩展的功能。

这是我整理的一个快速单元,展示了一个非常简单的示例。

unit MenuItemLogger;

interface

uses Menus;

Type
  TMenuItem = class(Menus.TMenuItem)
  public
    procedure Click; override;
  end;

implementation

uses windows;

{ TMenuItem }

procedure TMenuItem.Click;
begin
  outputdebugstring(PWideChar(self.Caption));
  inherited;
end;

end.

要使用上述单元,请将其作为带有要跟踪的菜单(TMainMenu 或 TPopupMenu)的任何表单/DataModule 的使用子句中的最后一个单元。 如果您不想跟踪特定单位,请不要包含它。

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActnList, Menus, MenuItemLogger;

这两种方法很简单,虽然它们确实有效,但可能不是最好的解决方案。

I've done something like this in the past.

There are two ways that I can think of to do this.

With Actions:

When using actions it's very easy to follow the UI usage by placing code in the TActionList.OnExecute handler. This event fires off before the individual action executes which allows for you to trace what has happened and when.

For Example:

procedure TForm1.ActionList1Execute(Action: TBasicAction; var Handled: Boolean);
begin
   WriteToLog(TAction(TBasicAction).Caption);
end;

Without Actions:

If your not using Actions it becomes a little more difficult but not impossible. You create have to create a new unit with a TMenuItem descendant with your logging code in it. Make sure to place your new unit after the MENU unit in the uses clause in every unit that makes use of it. The new descendant has to be called TMenuItem for this to work. Since your essentially reintroducing the same class but with extended functionality.

Here is a quick unit I threw together showing a very simple example.

unit MenuItemLogger;

interface

uses Menus;

Type
  TMenuItem = class(Menus.TMenuItem)
  public
    procedure Click; override;
  end;

implementation

uses windows;

{ TMenuItem }

procedure TMenuItem.Click;
begin
  outputdebugstring(PWideChar(self.Caption));
  inherited;
end;

end.

To use the above unit place it as the last unit in the uses clause of any form/DataModule with menus (TMainMenu or TPopupMenu) that you want to trace. If you don't want to trace a particular unit don't include it.

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActnList, Menus, MenuItemLogger;

These two methods are simple and while they do work they probably are not the best solutions.

月下凄凉 2024-08-02 06:25:31

我假设您正在谈论 Windows 性能计数器

看看这个 链接

使用 Windows 系统监视器 (SYSMON) 查看结果,

请查看此 链接

还有教授的性能监控组件对于德尔福

I assume you are talking about the windows performance counters

Have a look at this link

Use the Windows System Monitor (SYSMON) to see the result

have a look at this link

There is also Prof's Performance Monitoring Components for delphi

你げ笑在眉眼 2024-08-02 06:25:31

您需要一些覆盖率分析工具吗?

Do you need some coverage analysis tool?

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