gpt4 book ai didi

windows-phone-8 - Windows Phone 8模拟器上的控制台窗口功能

转载 作者:行者123 更新时间:2023-12-04 13:33:17 25 4
gpt4 key购买 nike

Windows Phone 7 Emulator具有很好的控制台窗口功能,可以通过注册表设置(EnableConsole)或XDE.exe的decfg参数启用它。

即使没有附加调试器,它也能正常工作。它有助于发现运行时绑定(bind)问题,异常。

有没有办法在Windos 8 Phone模拟器中启用控制台窗口?

最佳答案

WP8仿真器是WP7仿真器的完整重写,因此不太可能支持相同的未记录调试消息。归根结底,问题是:您要记录什么?

  • 您是否要获取有关您的应用程序的信息?然后使用Pavel通过WP8的CoreCon API共享IsoStore文件的想法。
  • 您是否正在尝试在模拟器本身中获取有关有趣事件的消息?仿真器记录到ETW提供程序,您可以从该日志中读取。我将在这里展示如何。
  • 您是否正在尝试从WP8操作系统内部获取信息?然后生成一个ETL文件并对其进行检查或直接使用概要分析API。


  • 记录应用程序特定的消息

    假设您的应用程式发生了一些有趣的事情,例如重要的按钮点击。您需要将其记录在您的应用程序中,然后将该消息写入IsoStore(或发送到自定义Web服务)。我将MetroLog用于WP8和Win8日志记录,但是只要文件被写入IsoStore,您就可以使用任何想要的东西。查看MetroLog @ https://github.com/mbrit/MetroLog

    然后,您可以使用CoreCon API读出文件。我已经上传了WP8 @ https://stackoverflow.com/a/13429709/81687的这些API的代码示例

    记录特定于模拟器的消息

    假设您有兴趣查看激活模拟器的时间,设置缩放的时间,截屏失败或发生触摸事件的时间。 WP8仿真器使用ETW提供程序ff86852d-541c-4f7e-98c5-5761e8cb7074记录其他事件。您可以在这里阅读更多有关ETW的信息@ http://msdn.microsoft.com/en-us/magazine/cc163437.aspx

    首先,下载PerfView以启动XDE.exe仿真器并开始捕获ETW输出。

  • 将工作目录设置为WP8的XDE.exe的位置。
  • 确保首先从VS2012运行该仿真器以创建Hyper-V镜像。或者,如果您知道如何操作,则可以自己整理图像并使用/VHD参数。
  • 调用XDE.exe时,可以从Hyper-V管理器获取/NAME参数。
  • 确保将额外的提供程序设置为包括“ff86852d-541c-4f7e-98c5-5761e8cb7074”。

  • 现在,从PerfView运行仿真器,执行一些操作,关闭仿真器并停止收集信息。完成此操作后,您将看到模拟器中发生的所有事件的日志。一旦在提供程序ID下对其进行了过滤,就会在“事件”日志下找到有趣的内容。



    在上面的打印屏幕中,您可以查看事件及其在模拟器中的发生时间。例如,事件76是模拟器的MicrophoneCaptureThreadStarted,它发生在分析 session 的27秒内。有关事件代码的完整列表,请参见XDE.exe程序集中的Microsoft.Xde.Etw.WindowsPhoneEmulatorProvider。复制的内容粘贴在这里供您说服:

    public WindowsPhoneEmulatorProvider()
    {
    this.m_provider = new EventProviderVersionTwo(new Guid("ff86852d-541c-4f7e-98c5-5761e8cb7074"));
    this.XdeStarted = new EventDescriptor(0, 0, 9, 4, 0, 0, -9223372036854775808L);
    this.XdeStopped = new EventDescriptor(1, 0, 0, 4, 0, 0, 0L);
    this.DesktopResolutionChanged = new EventDescriptor(2, 0, 0, 4, 0, 0, 0L);
    this.InvalidLanguageSpecified = new EventDescriptor(3, 0, 0, 2, 0, 0, 0L);
    this.CantFindVhd = new EventDescriptor(5, 0, 0, 2, 0, 0, 0L);
    this.DiffDiskVhdRequiresVhdPath = new EventDescriptor(6, 0, 0, 2, 0, 0, 0L);
    this.InvalidVideoParam = new EventDescriptor(7, 0, 0, 2, 0, 0, 0L);
    this.InvalidMemorySize = new EventDescriptor(8, 0, 0, 2, 0, 0, 0L);
    this.CantFindVM = new EventDescriptor(9, 0, 0, 2, 0, 0, 0L);
    this.UnableToSendKeyToVM = new EventDescriptor(10, 0, 0, 2, 0, 0, 0L);
    this.FailedToCreateDiffVhd = new EventDescriptor(11, 0, 0, 2, 0, 0, 0L);
    this.FailedToCreateVM = new EventDescriptor(12, 0, 0, 2, 0, 0, 0L);
    this.FailedVMStop = new EventDescriptor(13, 0, 0, 2, 0, 0, 0L);
    this.FailedStartVM = new EventDescriptor(14, 0, 0, 2, 0, 0, 0L);
    this.UnableToConnectToGuest = new EventDescriptor(15, 0, 0, 2, 0, 0, 0L);
    this.ConnectedToGuest = new EventDescriptor(0x10, 0, 0, 4, 0, 0, 0L);
    this.GuestIndicatedResolution = new EventDescriptor(0x11, 0, 0, 4, 0, 0, 0L);
    this.LoadedSkin = new EventDescriptor(0x12, 0, 0, 4, 0, 0, 0L);
    this.ButtonPressed = new EventDescriptor(0x13, 0, 0, 4, 0, 0, 0L);
    this.VirtualMachineStateChanged = new EventDescriptor(20, 0, 0, 4, 0, 0, 0L);
    this.ProxyInitialized = new EventDescriptor(4, 0, 0, 4, 0, 0, 0L);
    this.UsageShown = new EventDescriptor(0x16, 0, 0, 4, 0, 0, 0L);
    this.DisplayOrientationSet = new EventDescriptor(0x17, 0, 0, 4, 0, 0, 0L);
    this.ZoomSet = new EventDescriptor(0x18, 0, 0, 4, 0, 0, 0L);
    this.ScreenshotSavedToFile = new EventDescriptor(0x19, 0, 0, 4, 0, 0, 0L);
    this.KeySentToVM = new EventDescriptor(0x1a, 0, 0, 4, 0, 0, 0L);
    this.MouseEventSentToVM = new EventDescriptor(0x1b, 0, 0, 4, 0, 0, 0L);
    this.UnableToSendMouseEventToVM = new EventDescriptor(0x1c, 0, 0, 0, 0, 0, 0L);
    this.BringToFrontExecuted = new EventDescriptor(0x1d, 0, 0, 4, 0, 0, 0L);
    this.ConnectedToAccelerometer = new EventDescriptor(30, 0, 0, 4, 0, 0, 0L);
    this.UnableToConnectToAccelermometer = new EventDescriptor(0x1f, 0, 0, 0, 0, 0, 0L);
    this.InvalidWindowsDetected = new EventDescriptor(0x20, 0, 0, 2, 0, 0, 0L);
    this.HyperVNotEnabled = new EventDescriptor(0x21, 0, 0, 2, 0, 0, 0L);
    this.AskedToConnectExternalSwitches = new EventDescriptor(0x22, 0, 0, 4, 0, 0, 0L);
    this.ConnectedToGuestNotifications = new EventDescriptor(0x23, 0, 0, 4, 0, 0, 0L);
    this.UnableToConnectToGuestNotifications = new EventDescriptor(0x24, 0, 0, 2, 0, 0, 0L);
    this.FailedToSetVmProperties = new EventDescriptor(0x25, 0, 0, 2, 0, 0, 0L);
    this.FailedToInitializeSnapshots = new EventDescriptor(0x26, 0, 0, 2, 0, 0, 0L);
    this.FailedToSetVhd = new EventDescriptor(0x27, 0, 0, 2, 0, 0, 0L);
    this.RdpServerDisconnected = new EventDescriptor(40, 0, 0, 4, 0, 0, 0L);
    this.ScreenshotFailed = new EventDescriptor(0x29, 0, 0, 2, 0, 0, 0L);
    this.AccelerometerSendFailed = new EventDescriptor(0x2a, 0, 0, 2, 0, 0, 0L);
    this.LocationSendFailed = new EventDescriptor(0x2b, 0, 0, 2, 0, 0, 0L);
    this.SnapshotStarted = new EventDescriptor(0x2c, 0, 0, 0, 0, 0, 0L);
    this.SnapshotSucceeded = new EventDescriptor(0x2d, 0, 0, 0, 0, 0, 0L);
    this.SnapshotFailed = new EventDescriptor(0x2e, 0, 0, 2, 0, 0, 0L);
    this.CloseAfterSilentSnapshot = new EventDescriptor(0x2f, 0, 0, 0, 0, 0, 0L);
    this.ApplySnapshotFailed = new EventDescriptor(0x30, 0, 0, 2, 0, 0, 0L);
    this.RemovingSnapshotAfterFailedConnect = new EventDescriptor(50, 0, 0, 0, 0, 0, 0L);
    this.RemovingSnapshotAfterSettingsDidntMatch = new EventDescriptor(0x33, 0, 0, 0, 0, 0, 0L);
    this.ConnectedToShellReadyPipe = new EventDescriptor(0x34, 0, 0, 4, 0, 0, 0L);
    this.UnableToConnectToShellReadyPipe = new EventDescriptor(0x35, 0, 0, 2, 0, 0, 0L);
    this.ConnectedToTouch = new EventDescriptor(0x36, 0, 0, 4, 0, 0, 0L);
    this.UnableToConnectToTouch = new EventDescriptor(0x37, 0, 0, 2, 0, 0, 0L);
    this.TouchSendFailed = new EventDescriptor(0x38, 0, 0, 2, 0, 0, 0L);
    this.SendTextFailed = new EventDescriptor(0x39, 0, 0, 2, 0, 0, 0L);
    this.ReceiveAudioFromGuestWithSpinFailed = new EventDescriptor(0x3a, 0, 0, 2, 0, 0, 0L);
    this.SendMicrophoneDataToGuestFailed = new EventDescriptor(0x3b, 0, 0, 2, 0, 0, 0L);
    this.LoadUserSettingsFailed = new EventDescriptor(60, 0, 0, 0, 0, 0, 0L);
    this.SetGuestSystemTimeAndZoneFailed = new EventDescriptor(0x3d, 0, 0, 2, 0, 0, 0L);
    this.HypervisorNotRunning = new EventDescriptor(0x3e, 0, 0, 2, 0, 0, 0L);
    this.HyperVManagementServiceNotRunning = new EventDescriptor(0x3f, 0, 0, 2, 0, 0, 0L);
    this.UserAlreadyInHyperVAdmin = new EventDescriptor(0x40, 0, 0, 4, 0, 0, 0L);
    this.UserAddedToHyperVAdmins = new EventDescriptor(0x41, 0, 0, 4, 0, 0, 0L);
    this.FailedToAddUserToHyperVAdmins = new EventDescriptor(0x42, 0, 0, 0, 0, 0, 0L);
    this.SendKeyboardEvent = new EventDescriptor(0x43, 0, 0, 4, 0, 0, 0L);
    this.SendKeyboardEventFailed = new EventDescriptor(0x44, 0, 0, 2, 0, 0, 0L);
    this.AudioPlayThreadStarted = new EventDescriptor(0x45, 0, 0, 0, 0, 0, 0L);
    this.AudioPlayThreadExited = new EventDescriptor(70, 0, 0, 0, 0, 0, 0L);
    this.AudioDataReceivedFromGuest = new EventDescriptor(0x47, 0, 0, 0, 0, 0, 0L);
    this.AudioGlitch = new EventDescriptor(0x48, 0, 0, 0, 0, 0, 0L);
    this.AudioPaused = new EventDescriptor(0x49, 0, 0, 0, 0, 0, 0L);
    this.AudioResumed = new EventDescriptor(0x4a, 0, 0, 0, 0, 0, 0L);
    this.AudioDeviceChange = new EventDescriptor(0x4b, 0, 0, 0, 0, 0, 0L);
    this.MicrophoneCaptureThreadStarted = new EventDescriptor(0x4c, 0, 0, 0, 0, 0, 0L);
    this.MicrophoneCaptureThreadExited = new EventDescriptor(0x4d, 0, 0, 0, 0, 0, 0L);
    this.MicrophoneDataSentToGuest = new EventDescriptor(0x4e, 0, 0, 0, 0, 0, 0L);
    this.MicrophoneDeviceChange = new EventDescriptor(0x4f, 0, 0, 0, 0, 0, 0L);
    this.GetNetworkInfoFailed = new EventDescriptor(90, 0, 0, 2, 0, 0, 0L);
    this.IPRenewalInitiated = new EventDescriptor(0x5b, 0, 0, 4, 0, 0, 0L);
    }

    从Hyper-V托管的操作系统记录事件

    假设您想了解有关WP8 JIT如何组装或何时进行垃圾收集的更多信息。 VS2012附带了用于分析,存储和显示该信息的分析工具。例如,以下是启动分析 session 的方法:

    分析 session 完成后,您可以在应用程序下方看到“PerfLogs”文件夹,其中包含用于分析 session 的数据。如果您已经分析了CPU/执行,则可以在该文件夹中看到VSPX文件。将VSPX文件重命名为ZIP并解压缩其中包含的文件。在该ZIP文件中,您会找到一个ETL文件。该ETL文件是我们可以检查PerfView的另一个ETW日志。

    当我们在PerfView中打开这样的ETL文件时,我们可以看到对每个类进行JITT的时间,花费了多长时间以及IL和 native 大小。例如,我们的应用程序的App类在123.461ms时达到JITTed,持续1.2ms,IL大小为105,原生大小为289。

    您也许还可以直接使用概要分析API,而不是使用VS2012捕获该数据。如果您要这样做,则必须对VS2012的SilverlightProfiler。*。dll程序集进行反向工程,以查看它们在做什么,然后在VS2012之外重新创建它。

    关于windows-phone-8 - Windows Phone 8模拟器上的控制台窗口功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14227847/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com