Promo Fig1v2

Trace and Debugging: An Explanation, Techniques, and Applications

May 23, 2022
“这是一个错误的狩猎”……看现代痕迹和调试技术,例如静态和动态分析。

This article is part of the TechXchanges:Trace Debugging TechniquesDeveloping High-Quality Software

Members能够download this article in PDF format.

What you’ll learn:

  • Modern trace and debugging techniques.
  • IDEs to use for trace and debugging.


In computer programming and software development, engineers will deploy debugging tools and processes to find and mitigate "bugs" or problems within programs, applications, and systems. The word "debugging" was derived in the 1940s when a Mark II computer (Aiken Relay Calculator) malfunctioned, and engineers subsequently found a moth stuck in a relay, impeding normal operation.

各种技术和工具使工程师可以在软件环境中解决问题。随着软件和电子系统变得越来越复杂,各种调试技术已经扩大了更多的方法,以检测异常,评估影响并提供软件补丁或完整的系统更新。

从修复简单错误到执行冗长而广泛的任务(包括数据收集,分析和调度更新)的复杂性范围。软件调试的困难取决于系统的复杂性,并在某种程度上取决于所使用的编程语言和可用工具。

软件工具使程序员能够监视程序的执行,将其停止,重新启动,设置断点并更改内存中的值等。大部分调试过程是通过监视执行过程中的代码流来实时完成的,在应用程序部署之前的开发过程中更是如此。

什么是跟踪?

一个实时监控软件的技术debugging is known as "tracing," which involves a specialized use of logging to record information about a program's execution. Programmers typically use this information to diagnose common problems with software and applications. Tracing is a cross-cutting concern, meaning it involves aspects of a program that can affect other parts of the same system and, in turn, provides detailed information of the program as it's executed.

借助调试和跟踪,程序员能够监视错误和异常的应用程序,而无需集成开发环境(IDE)。在调试模式下,编译器将调试代码插入可执行文件中。由于调试代码是可执行文件的一部分,因此它在与代码相同的线程上运行。结果,它不提供代码的相同效率。

Trace在调试模式和记录模式下工作,并实时录制事件。使用跟踪而不是调试的主要优点是进行性能分析,这在调试端无法完成。

What's more, trace runs on a different thread. Thus, it doesn’t impact the main code thread. When used in tandem, tracing and debugging can provide information on program execution and root out errors in the code as they happen.

Trace Techniques

应该注意的是,跟踪和伐木是两个独立的实体。他们提供软件执行的概述,每个功能的功能都不同(Fig. 1)。记录以集中式方式记录错误报告和相关数据,显示应用程序或系统中的离散事件,例如故障,错误,损坏和转换状态。


On the other hand, tracing follows a program's flow and data progression, providing more information over a larger spectrum of the app stack. Tracing lets users see when and how the error occurred, including which function is at fault, duration, parameters, and how deep the function goes.

为此,各种技术和应用程序都可以执行该功能。这些技术取决于收集有关正在研究的系统的信息的能力。数据收集技术可以分为两类:静态分析和动态分析。

Static analysis使用源代码来揭示系统的组件和关系。执行静态分析的好处是涵盖程序的所有执行路径。但是,它只能够揭示系统的静态方面,并且在提供有关该程序行为特征的见解方面是有限的。由于所涉及的高度交互,这种见解对于分析分布式应用程序(例如基于服务的系统)可能至关重要。

Dynamic analysis是通过分析其执行轨迹来研究系统行为的研究。与静态分析不同,动态允许用户仅专注于需要分析的程序的一部分,这是通过分析活动组件的交互来完成的。动态分析还可以用于需要通过将系统输入与其输出联系起来来理解系统行为的应用程序。

动态分析有两种类型:在线和离线。在线分析活动系统运行时的行为。当下文分析的系统不会在长时间内终止其任务时,这种动态分析就会派上用场。离线分析与收集事件迹线的时间不同,这意味着在系统执行过程中收集事件迹线,而分析通常是在执行完成后执行的。

这使我们进入了分布式跟踪,该跟踪在云环境,微服务,基于容器的交付等中处理基于痕量的分析。分布式跟踪通过使用唯一标识符标记并与交易保持在与这些应用程序交互时保持与交易的交互来进行交互。上文提到的。

The unique identifier provides real-time visibility as the application runs through its process. It offers insight into the flow of requests through that microservice environment and identifies where failures or performance issues occur within the system.

申请

A wide variety of trace apps can provide in-depth insight into every software platform imaginable, with some being platform-specific for systems that utilize Android, Windows, and Linux, among a host of others. Below are several widely used trace applications that incorporate a variety of metrics and analytics for pinpointing bugs along the development chain.

Datadog APM

TheDatadog APM是一个基于云的软件性能监视器,包装了许多源数据,包括分布式跟踪消息(Fig 2)。The platform can collect and process OpenTracing and OpenTelemetry messages, which are filed with other indicators to make insight a breeze. It also aggregates statistics on microservice performance and application processing environments with agents that can target specific telemetry insight.


除了监视标准分布式追踪消息外,Datadog APM可以与包括Lambda Microservices平台在内的一系列AWS服务接口。此外,它生成的视觉表示,显示在层次结构中实时操作的微服务之间的连接。

New Relic APM

TheNew Relic APM针对想要监视其微服务基础架构的开发人员和企业。该平台将收集的数据集中在各种来源,包括通过OpentElemetry,OpentRacing,OpenCensus和Zipkin获得的分布式追踪消息。它还可以监视其他数据源,包括来自基础架构设备的应用程序日志文件,以及lambda,Azure,Apache和操作系统状态报告等AWS服务列表。

As with Datadog, New Relic deploys its own agents to provide additional insight into web and app performance, driven by microservice actions, including browser monitors and connection testers.

Dynatrace

Dynatrace是一个利用云的AI驱动平台,应用机器学习和启发式方法来从报告和记录系统生成的大量数据中识别关键信息。Dynatrace系统利用了opentrace标准和为给定应用程序做出贡献的过程。然后,它通过分析分布式追踪消息来跟踪回溯,以识别用于该应用程序的给定会话中工作的所有微服务。

While the platform allows developers and system managers to write and test microservices efficiently, it also monitors application performance and will produce alerts if a problem is identified within that microservice.

在TechXchanges中阅读更多文章:Trace Debugging TechniquesDeveloping High-Quality Software

最新的

Murata-IRA IRA-S210ST01 pyroelectric红外传感器

March 31, 2022
Murata IRA-S210ST01是一种含有铅的Pyroelectric红外传感器,可提供良好的信噪比和可靠的性能。

Nexperia — PMEGxxxTx Trench Schottky Rectifiers

March 31, 2022
Nexperia has extended its portfolio of trench Schottky rectifiers with devices rated at up to 100 V and 20 A. The new parts feature excellent switchi…

Women in Engineering – Inspiring Creative Growth in Our Field

2022年3月8日
在过去的几年中,技术或工程专业的女性人数增加了。入学后EN的妇女人数…

GMR的汽车车轮传感的未来

2022年2月23日
Download PDF Version. Allegro MicroSystems. Magnetic sensors are used extensively in modern vehicles, serving to measure the position of moving parts,…

表达您的意见!

This site requires you to register or login to post a comment.
尚未添加评论。想开始对话吗?
Baidu