Remember a .NET analysis of CPU explosion in a pharmaceutical company’s business system

Remember a .NET analysis of CPU explosion in a pharmaceutical company’s business system one: background 1. Storytelling Some time ago, a friend came to me and said that their program had a CPU explosion and asked me to help find out what happened? The best way to solve this problem is to grab a dump and throw it to me. The recommended tool is to use procdump to automate the capture. Two: Windbg analysis 1. Is the CPU really high? Still the same old rule, if you want to find this answer, you can use the !tp command. 0:044> !tp logStart: 1 logSize: 200 CPU utilization: 88% Worker Thread: Total: 8 Running: 4 Idle: 4 MaxLimit: 1023 MinLimit: 4 Work Request in Queue: 0 ———————————————– Number of Timers: 2 ———————————————– Completion Port Thread:Total: 2 Free: 2 MaxFree: 8 CurrentLimit: 2 MaxLimit: 1000 MinLimit: 4 From the data in the hexagram, it can be seen that the current CPU has indeed reached 88%. Next, we will observe whether the machine CPU of this program is powerful. You can use !cpuid to observe. 0:044> !cpuid CP F/M/S Manufacturer MHz 0 6,94,3 GenuineIntel 3192 1 6,94,3 GenuineIntel 3192 2 6,94,3 GenuineIntel 3192 3…

Open source .NetCore general tool library Xmtool usage serialization – Image processing

Open source .NetCore general tool library Xmtool usage serial – Image processing articles [Github source code] “Previous Article” introduced the extended dynamic objects in the Xmtool tool library. Today we will continue to introduce to you the image processing class library. In our software system, we often need to perform various processing on images; for example, the most common avatar scaling requires scaling the images uploaded by users to the optimal size required by the system. This toolkit mainly summarizes commonly used image methods for the convenience of developers. Currently, the package only provides methods for image scaling and image generation base64 strings, and will continue to be added as needed. Zoom image files Scale the image data stream Convert image files into Base64 strings Convert image data stream into Base64 string Convert the content of the Image object into a Base64 string 1. Zoom the image file public Image Resize(string originFile, int height, int width, bool keepRatio, bool getCenter) Description: Scale the original image file to the specified width and height, and return the generated image object. ImageTool tool = Xmtool.Image(); Image result = tool.Resize(“c:\avatar.png”, 200, 200, true, true); // TODO 2. Scale the image data stream public Image…

[c# winform] devexpress treeList right-click menu adds button

[c# winform] devexpress treeList right-click menu adds button This article provides two methods that do not require manual addition of edit controls. Method 1: Create a new right-click menu and add the “Execute Selection” button, and suppress the TreeList’s own menuResult display: Code: private void Form1_Load(object sender, EventArgs e ) { CreateBarButtonItem(); } private void span> CreateBarButtonItem() { // Create a right button Menu ContextMenuStrip contextMenuStrip = new ContextMenuStrip(); // Add” Execute Select menu item ToolStripMenuItem execSelectedItem = new ToolStripMenuItem(“Execute selection”); execSelectedItem.Click += ExecSelectedItem_Click; ; contextMenuStrip.Items.Add(execSelectedItem); // Associated right-click Menu and TreeList control treeList1.PopupMenuShowing += TreeList1_PopupMenuShowing; } private void span> TreeList1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) { // Disable auto With right-click menu e.Allow = false; } private void span> ExecSelectedItem_Click(object sender, EventArgs e) { //Process ” Execute selection” event logic } Method 2: Add the “Execute Selection” button to the TreeList’s own menu Result display: Right-click on an empty node Right-click the node and retain the built-in menu function Right-click the column title and retain the built-in menu function‍ Code: private void Form1_Load(object sender, EventArgs e ) { treeList1.PopupMenuShowing += TreeList1_PopupMenuShowing;//Customized right-click display menu } private void span> TreeList1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) { // Get the right button Menu if (e.Menu…

Let’s talk about where the context goes after C# thread switching

Let’s talk about where the context goes after C# thread switching one: background 1. Storytelling Some friends will always ask a question. When a thread performs context switching in Windows, where does the register context of the switched thread go? Can you dig it out for me? This problem is actually relatively low-level. If you don’t have a system-level understanding of the operating system and have done source code analysis, it is actually difficult to explain. In this article, we will try to analyze it from the perspective of .NET Advanced Debugging . Two: Where has the register context gone 1. Two-state space of user thread Threads created with C# code belong to User mode threads at the operating system level. This kind of thread has two thread stacks. Haha, does it break some friends’ opinions? They are User mode stack and Kernel mode stack respectively. For the convenience of explanation, write a simple test code and continuously call Sleep(1) to allow the code to continuously switch between user mode and kernel mode, and you can observe these two sets of stack spaces. , the reference code is as follows: static void Main(string[] args) { for (int i = 0;…

Step by step introduction to WPF application development based on CommunityToolkit.Mvvm and HandyControl (4) — Implementing the import and export operations of DataGrid data

Step by step introduction to WPF application development based on CommunityToolkit.Mvvm and HandyControl (4) — Implementing the import and export operations of DataGrid data In many places in our design software, we see the need to import and export table data, mainly to facilitate customers to quickly process and share data. This essay introduces the import and export operations of DataGrid data based on WPF. . In many places in our design software, we see the need to import and export table data, mainly to facilitate customers to quickly process and share data. This essay introduces the import of DataGrid data based on WPF and export operations. 1. System interface design Before we implement the data import and export function, we need to provide customers with relevant operation buttons on the main interface. As shown in the following interface, import Excel, export PDF, and export Excel are provided at the top of the list. Since these operation functions are basically used in every page module, they should be abstracted to base classes as much as possible and provide common processing operations. If there are differences, they can also be overridden by some attributes or event methods. way to achieve it.…

In-depth understanding of the design ideas of MVVM in WPF

In-depth understanding of the design ideas of MVVM in WPF In recent years, as WPF has become more and more widely used in production, manufacturing, industrial control and other fields, many companies have gradually increased their demand for WPF development, causing many people to see potential opportunities and continue to switch from Web and WinForm development to WPF development, but WPF development also has many new concepts and design ideas, such as: data drive, data binding, dependency properties, commands, control templates, data templates, MVVM, etc., which are very different from traditional WinForm and ASP.NET WebForm development. Today, I will use a simple example to briefly describe the design ideas and applications of MVVM in WPF development. In recent years, as WPF has become more and more widely used in production, manufacturing, industrial control and other fields, many companies have gradually increased their demand for WPF development, causing many people to see potential opportunities and continue to develop from Web and WinForm I turned to WPF development, but WPF development also has many new concepts and design ideas, such as: data drive, data binding, dependency properties, commands, control templates, data templates, MVVM, etc., which are different from traditional WinForm and ASP.NET…

.net core swagger grouping and group hiding

.net core swagger grouping and group hiding Since there are many swagger interfaces, it is better to divide them into groups. It is more intuitive to view them in the form of pictures and texts Define groups Add group Board display two groups I want to hide the v1 group, first understand the ApplicationModel ApplicationModel describes various objects and behaviors in the application, including Application, Controller, Action, Parameter, Router, Page, Property, Filter, etc., and the Asp.Net Core framework itself has a built-in set of rules to process these models , and also provides interfaces for us to customize conventions to extend the model to implement applications that better meet our needs. ModelConvention defines the entrance to the operating model, through which the model can be modified. Commonly used ones include: IApplicationModelConventionIControllerModelConventionIActionModelConventionIParameterModelConventionIPageRouteModelConvention These interfaces provide a common method Apply, and the method parameters are the respective application models. And it will only be executed once when the program starts (Text quoted from: https://blog.csdn.net/laosunlaiye/article/details/122174543) Injection

Start an ASP.NET Core application on boot using a task scheduler

Use task scheduler to start ASP.NET Core application Using Windows Task Scheduler to start ASP.NET Core applications at boot time is the easiest way The ASP.NET Core application is now a console application, which can be started directly by double-clicking on Windows. However, if you want the developed ASP.NET Core application to start at boot, you can modify the ASP.NET Core application to Windows services run, but this requires additional code. You can also use IIS to host ASP.NET Core applications, but you may need to install some components that support IIS. The third way is to use Windows Task Scheduler to set up startup. However, when an ASP.NET Core application is started directly using the Windows Task Plan, the ASP.NET Core application cannot correctly read the application’s configuration file, causing the program to run incorrectly. The cause of the problem lies in the task plan. The current working directory of execution is not the directory where the ASP.NET Core application is located, and setting the current working directory directly in the ASP.NET Core application is invalid. The directory of the configuration file may have been determined before the application is started, such as the following Code: var app =…

image.png

How to custom configure the starting day of last week and this week to query business data in C#?

How to custom configure the starting day of last week and this week to query business data in C#? When doing a certain report management function, there is a requirement: it is necessary to count the order data of last week and this week based on the custom configured [Start Day of Week]. There is no encapsulated method in C# to directly obtain the day from the previous week to the day and the day from the current week to the day according to our needs, so we need to encapsulate the method ourselves to implement it (we can also use other languages ​​​​to follow this idea) ). Author: Xigua Programmer Home page portal: https://www.cnblogs.com/kimiliucn Foreword When doing a certain report management function, there is a requirement: it is necessary to count the order data of last week and this week based on the custom configured [Start Day of Week]. There is no encapsulated method in C# to directly obtain the day from the previous week to the day and the day from the current week to the day according to our needs, so we need to encapsulate the method ourselves to implement it (we can also use other languages…

Explore the underlying implementation of WPF’s ITabletManager.GetTabletCount in Win11 system

Explore the underlying implementation of WPF’s ITabletManager.GetTabletCount in Win11 system This article will introduce to you the underlying implementation of the GetTabletCount method of ITabletManager provided for WPF touch module in Windows 11 system. This article will introduce to you the underlying implementation of the GetTabletCount method of ITabletManager provided specifically for the WPF touch module in Windows 11 system This article belongs to a series of blogs related to WPF touch, focusing on the bottom layer of the system. For more touch blogs, please see WPF touch related As we all know, in Windows 7 system, there are dedicated pen and touch services to provide support for touch messages. WPF is a framework that has been around since the Vista era, so it naturally needs to support the XP system. In the XP system, there is no perfect WM_Touch message, and at the same time, performance needs to be taken into consideration. The best solution is RealTimeStylus. There is a set of COM interfaces specifically used for WPF touch modules under Windows. This set of interfaces provides almost the same implementation functions as RealTimeStylus. For details, please see https://learn.microsoft.com/en-us/windows/win32/tablet /com-apis-used-by-windows-presentation-foundation For more introduction to this COM touch layer, please…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索