Imgui(2) | macOS 绘制 CPU 占用率曲线

news/发布时间2024/5/14 16:41:33

Imgui(2) | macOS 绘制 CPU 占用率曲线

文章目录

  • Imgui(2) | macOS 绘制 CPU 占用率曲线
    • 0. 简介
    • 1. 绘制曲线 - 以正弦函数为例
      • 1.1 基于 `sf::RectangleShape` 的渲染 - 不好看,效率低
      • 1.2 基于 `sf::VertexArray` 的绘制
    • 2. 获取和绘制所有 CPU 的占用率
      • 2.1 测试程序 - 用满所有 CPU
      • 2.2 获取 CPU 占用率
      • 2.3 SFML获取和绘制cpu占用率
      • 2.4 效果和小节
    • 3. 增加按钮: 在界面上开启和关闭评测程序
      • 3.1 改造测试代码
      • 3.2 引入 imgui-SFML, 增加按钮
    • 4. 提高绘制频率
    • 5. 总结
    • References

0. 简介

实现一个 CPU 占用率曲线绘制的程序, 并能通过按钮触发评测代码的运行; 跨平台。 使用到了 SFML, imgui-SFML, 以及 macOS 平台特有的 API.

规划:

  1. 绘制曲线 - 以正弦函数为例
  2. 获取和绘制所有 CPU 的占用率
  3. 增加按钮: 在界面上开启和关闭评测程序
  4. 提高绘制频率

started: 2024.02.14 10:30~15:30

1. 绘制曲线 - 以正弦函数为例

y = sin(x) 获得一系列坐标点, 使用 sf::VertexArray 进行绘制, 得到相对平滑的结果, 且渲染效率较高。

1.1 基于 sf::RectangleShape 的渲染 - 不好看,效率低

开始时候我用 sf::RectangleShape 执行单个坐标点的绘制, 存在这些问题:

  • 相邻点之间没有连线,锯齿感明显
  • 每个点调用一次 window.draw(), GPU 利用率不高

请添加图片描述

#include <SFML/Graphics.hpp>int main()
{constexpr int win_width = 800;constexpr int win_height = 600;const std::string title = "cpu consumption curve - SFML";sf::RenderWindow window(sf::VideoMode(win_width, win_height), title);window.setFramerateLimit(10);constexpr int grid_len = 1;int idx = 0;while (window.isOpen()){sf::Event event;while (window.pollEvent(event)){if (event.type == sf::Event::Closed){window.close();}}window.clear();// draw heresf::RectangleShape rect(sf::Vector2f(grid_len, grid_len));rect.setFillColor(sf::Color::Green);for (int i = 0; i < win_width; i++){float x = (i * 1.0 / win_width) * 10 * 3.14;float y = sin(x) * win_height/4 + win_height/2 - grid_len/2;rect.setPosition(i, y); // centerwindow.draw(rect);}window.display();}return 0;
}

1.2 基于 sf::VertexArray 的绘制

在 SFML Tutorial - Designing your own entities with vertex arrays 文档提到, 多次调用 window.draw() 效率很低, 很容易到达显卡极限。 好的做法是使用 sf::Vertext 把要绘制的东西一次性准备好, 只调用一次 window.draw():

SFML provides simple classes for the most common 2D entities. And while more complex entities can easily be created from these building blocks, it isn’t always the most efficient solution. For example, you’ll reach the limits of your graphics card very quickly if you draw a large number of sprites. The reason is that performance depends in large part on the number of calls to the draw function. Indeed, each call involves setting a set of OpenGL states, resetting matrices, changing textures, etc. All of this is required even when simply drawing two triangles (a sprite). This is far from optimal for your graphics card: Today’s GPUs are designed to process large batches of triangles, typically several thousand to millions.

To fill this gap, SFML provides a lower-level mechanism to draw things: Vertex arrays. As a matter of fact, vertex arrays are used internally by all other SFML classes. They allow for a more flexible definition of 2D entities, containing as many triangles as you need. They even allow drawing points or lines.

请添加图片描述

关键代码修改如下:

// draw here
// sf::RectangleShape rect(sf::Vector2f(grid_len, grid_len));
// rect.setFillColor(sf::Color::Green);
// for (int i = 0; i < win_width; i++)
// {
//     float x = (i * 1.0 / win_width) * 10 * 3.14;
//     float y = sin(x) * win_height/8 + win_height/2 - grid_len/2;
//     rect.setPosition(i, y); // center
//     window.draw(rect); // 原来: 在一帧内多次调用 window.draw(), 渲染效率低
// }sf::VertexArray line(sf::LineStrip, win_width);
for (int i = 0; i < win_width; i++)
{float x = (i * 1.0 / win_width) * 10 * 3.14;float y = sin(x) * win_height/8 + win_height/2 - grid_len/2;line[i].position = sf::Vector2f(i, y);line[i].color = sf::Color::Green;
}
window.draw(line); // 现在: 在一帧内只调用一次 window.draw(), 渲染效率高

2. 获取和绘制所有 CPU 的占用率

MacOS 禁止用户自行设定 CPU 亲和性 (Affinity), 尝试过编译运行 “只有 while 死循环” 的程序,占用的 CPU 会跳来跳去。 与其飘忽不定, 不如开启多个线程: 我的 Mac-Mini 有 8 个 CPU, 因此开启 8 个线程, 每个线程都运行一样的死循环代码, 然后获取所有 CPU 的占用率并绘制曲线。

2.1 测试程序 - 用满所有 CPU

在开启 nproc 个线程时, 虽然操作系统不一定是把每个线程分配到不同的 CPU 上, 但电脑整体比较空闲的情况下, 大概率是可以确保这个理想分配的。

性能测试程序代码:

#include <thread>void run()
{int i = 0;while (true){i++;}
}int main()
{constexpr int n = 8;std::thread threads[n];for (int i = 0; i < n; i++){threads[i] = std::thread(run);}for (int i = 0; i < n; i++){threads[i].join();}return 0;
}

2.2 获取 CPU 占用率

参照了 c++获取windows、mac的cpu利用率 这篇文章, 获取了 macOS 下的 CPU 整体占用率, 关键函数是 host_statistics(), 位于 mach/mach_host.h, 但是没有任何注释。 这篇参考博客的做法是, 每隔 1 秒调用一次 host_statistics() 来获得 cpu 相关信息, 两次调用的结果做差值, 得到的差值里的几个时间, 构成了 cpu 占用率:

CPU占用百分比 = (user时间 + system时间 + nice时间) / (上面👆这一坨,再加上 idle 时间) * 100

#include <mach/mach.h>
#include <sys/types.h>
#include <sys/sysctl.h>#define CP_USER   0
#define CP_SYS    1
#define CP_IDLE   2
#define CP_NICE   3
#define CP_STATES 4host_cpu_load_info_data_t load1, load2;host_cpu_load_info_data_t get_cpu_percentage()
{kern_return_t error;mach_msg_type_number_t count;host_cpu_load_info_data_t r_load;mach_port_t mach_port;count = HOST_CPU_LOAD_INFO_COUNT;mach_port = mach_host_self();error = host_statistics(mach_port, HOST_CPU_LOAD_INFO, (host_info_t)&r_load, &count);if (error != KERN_SUCCESS){return host_cpu_load_info_data_t();}return r_load;
}float getCpuUsePercentage()
{load2 = get_cpu_percentage();// pre load timesunsigned long long current_user = load1.cpu_ticks[CP_USER];unsigned long long current_system = load1.cpu_ticks[CP_SYS];unsigned long long current_nice = load1.cpu_ticks[CP_NICE];unsigned long long current_idle = load1.cpu_ticks[CP_IDLE];// Current load timesunsigned long long next_user = load2.cpu_ticks[CP_USER];unsigned long long next_system = load2.cpu_ticks[CP_SYS];unsigned long long next_nice = load2.cpu_ticks[CP_NICE];unsigned long long next_idle = load2.cpu_ticks[CP_IDLE];// Difference between the twounsigned long long diff_user = next_user - current_user;unsigned long long diff_system = next_system - current_system;unsigned long long diff_nice = next_nice - current_nice;unsigned long long diff_idle = next_idle - current_idle;float value = static_cast<float>(diff_user + diff_system + diff_nice) / static_cast<float>(diff_user + diff_system + diff_nice + diff_idle) * 100.0;load1 = load2;return value;
}

2.3 SFML获取和绘制cpu占用率

设置了FPS不超过 60, 每60帧获取一次 CPU 占用率(从而更新需要绘制的数据), 每一帧都绘制当前的 CPU 占用率。

更新数据指的是, 对于绘制任务, 每个数据在时间维度上, 相当于左移一个单位, 因此搬运需要显示的数据数量 num_bins 再减去 1 个的数据,都搬运到它前面一个, 然后填充最后一个数据, 就完成了更新, 在画面上变现为: 原来的 CPU 占用率折线被向左平移了 1 个bin的单位。 每一帧的更新数据和渲染, 代码如下:

    frameIdx++;if (frameIdx % 60 == 0){load2 = get_cpu_percentage();float cpu_use = getCpuUsePercentage();for (int i = 0; i < num_bins - 1; i++){cpu_usage[i] = cpu_usage[i + 1];}cpu_usage[num_bins - 1] = cpu_use;frameIdx = 0;}sf::VertexArray line(sf::LinesStrip, num_bins);for (int i = 0; i < num_bins; i++){float usage = cpu_usage[i];float x = i * bin_size;float y = win_height - (usage / 100) * win_height;line[i].position = sf::Vector2f(x, y);}window.draw(line);printf("cpu_usage[%d] = %f\n", num_bins - 1, cpu_usage[num_bins - 1]);

2.4 效果和小节

通过使用 SFML 和 macOS 的 API, 获取并绘制了总体的 CPU 占用率, 通过编写和开启测试程序, 在开启 4 个线程的情况下, 可以看到 CPU 占用率在 50% 左右:
请添加图片描述

3. 增加按钮: 在界面上开启和关闭评测程序

按钮是 GUI 的组件, 这一节需要使用 imgui 和 imgui-SFML.

3.1 改造测试代码

需要改造评测代码, 让它能够被随时开启和关闭:

  • 在 GUI 方面, 增加 start benchmark 和 stop benchmark 按钮, 来控制测试代码的开启和关闭
  • 在代码实现层面:
    • 重构原有的测试代码,让它的 while(true) 改为 while(running), running 是 std::atomic<bool> 类型
    • 在 SFML 的 main loop 中集成: 增加按钮按下的响应事件
    • 在响应事件函数 startBenchmark()stopBenchmark() 函数中, 通过创建和效果新的线程,在线程中运行、等待测试代码

非阻塞的响应

其中按钮的响应函数中, 如果没有通过新开线程来执行测试代码, 会导致界面卡死。 使用了新开线程后则不会。关键代码:

BenchmarkRunner runner; // 被测试的代码, 封装为了类
std::thread benchmark_thread;void startBenchmark()
{runner.running = true;benchmark_thread = std::thread(&BenchmarkRunner::benchmark, &runner);
}void stopBenchmark()
{runner.running = false;if (benchmark_thread.joinable()){benchmark_thread.join();}
}

重构了的性能测试代码

以 OOP 的方式提供使用:

#pragma once#include <atomic>
#include <thread>class BenchmarkRunner {
public:void benchmark(){constexpr int n = 4;std::thread threads[n];for (int i = 0; i < n; i++){threads[i] = std::thread([this] { this->run(); });}for (int i = 0; i < n; i++){threads[i].join();}}std::atomic<bool> running = true;
private:void run(){int i = 0;while (running){i++;}}
};

3.2 引入 imgui-SFML, 增加按钮

增加两个按钮, 注册它们的响应函数

        ImGui::Begin("Hello"); // [imgui]ImGui::Button("Start Benchmark"); // [imgui]ImGui::Button("Stop Benchmark"); // [imgui]ImGui::End(); // [imgui]if (ImGui::Button("Start Benchmark")){startBenchmark();}if (ImGui::Button("Stop Benchmark")){stopBenchmark();}

main loop增加 imgui-SFML 的套路代码

标记为 [imgui-SFML] 的是新增的套路代码:

int main()
{constexpr int win_width = 800;constexpr int win_height = 600;const std::string title = "cpu consumption curve - SFML";sf::RenderWindow window(sf::VideoMode(win_width, win_height), title);window.setFramerateLimit(60);bool success = ImGui::SFML::Init(window); // [imgui-SFML]if (!success)return -1;constexpr int grid_len = 1;constexpr int bin_size = 10;constexpr int num_bins = win_width / bin_size;std::vector<float> cpu_usage(num_bins, 0);int frameIdx = 0;load1 = get_cpu_percentage();sf::Clock deltaClock;while (window.isOpen()){sf::Event event;while (window.pollEvent(event)){ImGui::SFML::ProcessEvent(window, event); // [imgui-SFML]if (event.type == sf::Event::Closed){window.close();}}ImGui::SFML::Update(window, deltaClock.restart()); // [imgui-SFML]frameIdx++;window.clear();//draw_sin_x_wave(win_width, win_height, grid_len, window);ImGui::Begin("Hello"); // [imgui]ImGui::Button("Start Benchmark"); // [imgui]ImGui::Button("Stop Benchmark"); // [imgui]ImGui::End(); // [imgui]if (ImGui::Button("Start Benchmark")){startBenchmark();}if (ImGui::Button("Stop Benchmark")){stopBenchmark();}if (1){if (frameIdx % 60 == 0){load2 = get_cpu_percentage();float cpu_use = getCpuUsePercentage();for (int i = 0; i < num_bins - 1; i++){cpu_usage[i] = cpu_usage[i + 1];}cpu_usage[num_bins - 1] = cpu_use;frameIdx = 0;}sf::VertexArray line(sf::LinesStrip, num_bins);for (int i = 0; i < num_bins; i++){float usage = cpu_usage[i];float x = i * bin_size;float y = win_height - (usage / 100) * win_height;line[i].position = sf::Vector2f(x, y);}window.draw(line);printf("cpu_usage[%d] = %f\n", num_bins - 1, cpu_usage[num_bins - 1]);}ImGui::SFML::Render(window); // [imgui-SFML]window.display();}return 0;
}

效果如下

当按下了 Start Benchmark 后, CPU 占用率曲线飙升到 50% 左右(因为开了 4 个线程); 当按下 Stop Benchmark 后, 曲线会降低下来:
请添加图片描述

4. 提高绘制频率

github 上找到的 CPU-Profiler 项目, 运行的时候的能够以低于 1 秒的频率更新绘制曲线, 相关实现在 src/Consumption/TotalConsumption.cppsrc/Consumption/TotalConsumption.hpp 中, 和前面提到的 CSDN 参考博客实现方法, 调用了同样的 host_statistics() 函数和参数:

double TotalConsumption::getCurrentValue()
{host_cpu_load_info_data_t cpuInfo;mach_msg_type_number_t count = HOST_CPU_LOAD_INFO_COUNT;if (host_statistics(mach_host_self(), HOST_CPU_LOAD_INFO, (host_info_t)&cpuInfo, &count) == KERN_SUCCESS){unsigned long long totalTicks = 0;for (unsigned cpu_tick : cpuInfo.cpu_ticks)totalTicks += cpu_tick;return calculate(cpuInfo.cpu_ticks[CPU_STATE_IDLE], totalTicks);}elsereturn -1.0f;
}

CPU-Profiler 的绘制很快, 并且没有取值为 0 的 cpu占用率突变点(折线的突然截断没显示,因为数值是 nan), 因为作者判断当执行除法的分母(也就是总时间)是 0 的时候,返回 100.0 而不是 0.0:

float TotalConsumption::calculate(unsigned long long idleTicks,unsigned long long totalTicks)
{auto totalTicksSinceLastTime = totalTicks - _previousTotalTicks;auto idleTicksSinceLastTime  = idleTicks  - _previousIdleTicks;float diff = static_cast<float>(idleTicksSinceLastTime) / totalTicksSinceLastTime;float ans = 1.0f;if (totalTicksSinceLastTime > 0)ans -= diff;_previousTotalTicks = totalTicks;_previousIdleTicks  = idleTicks;return ans * 100;
}

我们照搬这个做法到自己的代码:


float getCpuUsePercentage()
{load2 = get_cpu_percentage();// pre load timesunsigned long long current_user = load1.cpu_ticks[CP_USER];unsigned long long current_system = load1.cpu_ticks[CP_SYS];unsigned long long current_nice = load1.cpu_ticks[CP_NICE];unsigned long long current_idle = load1.cpu_ticks[CP_IDLE];// Current load timesunsigned long long next_user = load2.cpu_ticks[CP_USER];unsigned long long next_system = load2.cpu_ticks[CP_SYS];unsigned long long next_nice = load2.cpu_ticks[CP_NICE];unsigned long long next_idle = load2.cpu_ticks[CP_IDLE];// Difference between the twounsigned long long diff_user = next_user - current_user;unsigned long long diff_system = next_system - current_system;unsigned long long diff_nice = next_nice - current_nice;unsigned long long diff_idle = next_idle - current_idle;load1 = load2;float total = diff_user + diff_system + diff_nice + diff_idle;if (total > 0) // 如果没有判断 total > 0, total 有时候是 0,会导致 value 是 nan,进而出现cpu占用率折线图的 突然截断{return static_cast<float>(diff_user + diff_system + diff_nice) / static_cast<float>(total) * 100.0;}return 100.0;
}

对我我的实现和 CPU-Profiler 的实现:
请添加图片描述

5. 总结

本篇使用 C++ 实现了一个简陋的 CPU 占用率界面程序, 给出了实现的关键部件, 以及一些探索过程。

从界面上看, 能够绘制所有 CPU 的总体占用率曲线, 并且按照1 秒(或更短)为间隔,更新CPU占用率的值并绘制折线; 通过提供两个按钮,触发独立的线程来执行 “benchmark 测试程序”。使用独立线程的原因是为了避免阻塞 UI 显示的主线程。

所谓 benchmark 测试程序, 是基于《编程之美》一书开头提到的控制 CPU 占用率曲线的问题, 写了一个让单个CPU占用率 100%、 通过多线程运行, 从而让多个 CPU 核心的占用率都到 100%。 使用多个线程的原因是 macOS 不提供 CPU 绑核(亲和性)的 API, 为了防止测试程序在不同 CPU 上乱跳, 索性多开几个线程来运行。

从界面的实现来看:

  • 首先基于 SFML 绘制了曲线, 由于要绘制多个点, sf::VertexArray 的绘制效率远远高于 sf::RectangleShape, 前者只需要一次绘制, 后者则需要 n 次绘制, 可以在 SFML Tutorial - Designing your own entities with vertex arrays 文章中得到解释。

  • 然后使用 macOS 的 API host_statistics() 的封装代码, 通过前后两次计算差值来获取 CPU 占用率。 对于差值的计算, 时间间隔不能太快, 太快的话会获取到总时间为0, 参考了 CPU-Profiler 的做法, 也就是此时的 CPU 占用率赋值为100%, 这其实并不准确。

  • 为了减少评测代码和 CPU占用率绘图代码的切换繁琐问题, 在GUI上创建了按钮,通过按钮触发了性能测试程序的启动和停止。 这些按钮的添加, 按钮本身是 imgui 的东西, 通过 imgui-SFML 框架, 得以和原本的 SFML 窗口渲染程序结合显示。

这个程序并不完美, 比如只支持了 macOS 而没有支持 Windows/Linux, 评测程序过于简单只做了100% CPU 占用的实现、 没有实现正弦曲线的绘制。有空会考虑补充实现。

References

  • SFML Tutorial - Designing your own entities with vertex arrays
  • c++获取windows、mac的cpu利用率
  • CPU-Profiler
  • host_statistics - Apple Docs

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.bcls.cn/hcdV/1861.shtml

如若内容造成侵权/违法违规/事实不符,请联系编程老四网进行投诉反馈email:xxxxxxxx@qq.com,一经查实,立即删除!

相关文章

【机器学习笔记】11 支持向量机

支 持 向 量 机 &#xff08; Support Vector Machine,SVM &#xff09; 支 持 向 量 机 是 一 类 按 监 督 学 习 &#xff08; supervisedlearning&#xff09;方式对数据进行二元分类的广义线性分类器&#xff08;generalized linear classifier&#xff09;&#xff0c;其…

威尔金森功分器基本原理学习笔记

威尔金森功分器基本原理 威尔金森功率分配器的功能是将输入信号等分或不等分的分配到各个输出端口&#xff0c;并保持相同输出相位。环形器虽然有类似功能&#xff0c;但威尔金森功率分配器在应用上具有更宽的带宽。微带形功分器的电路结构如图所示&#xff0c;其中&#xff0…

代码随想录算法训练营第二十四天 | 回溯算法理论基础,77. 组合 [回溯篇]

代码随想录算法训练营第二十四天 回溯算法理论基础什么是回溯法回溯法的理解回溯法模板 LeetCode 77.组合题目描述思路参考代码总结优化版本 回溯算法理论基础 文章讲解&#xff1a;代码随想录#回溯算法理论基础 视频讲解&#xff1a;带你学透回溯算法&#xff08;理论篇&#…

stm32——hal库学习笔记(外部中断)

一、什么是中断&#xff1f;&#xff08;了解&#xff09; 打断CPU执行正常的程序&#xff0c;转而处理紧急程序&#xff0c;然后返回原暂停的程序继续运行&#xff0c;就叫中断 中断的作用和意义 中断的意义&#xff1a;高效处理紧急程序&#xff0c;不会一直占用CPU资源 S…

fastApi笔记01-路径参数

路径参数 使用与 Python 格式化字符串相同的语法来声明路径"参数"或"变量" from fastapi import FastAPIapp FastAPI()app.get("/items/{item_id}") def read_item(item_id):return {"item_id": item_id} http://127.0.0.1:8000/i…

论文阅读:四足机器人对抗运动先验学习稳健和敏捷的行走

论文&#xff1a;Learning Robust and Agile Legged Locomotion Using Adversarial Motion Priors 进一步学习&#xff1a;AMP&#xff0c;baseline方法&#xff0c;TO 摘要&#xff1a; 介绍了一种新颖的系统&#xff0c;通过使用对抗性运动先验 (AMP) 使四足机器人在复杂地…

建造者模式-Builder Pattern

原文地址:https://jaune162.blog/design-pattern/builder-pattern/ 引言 现在一般大型的业务系统中的消息通知的形式都会有多种,比如短信、站内信、钉钉通知、邮箱等形式。虽然信息内容相同,但是展现形式缺不同。如短信使用的是纯文本的形式,钉钉使用的一般是Markdown的形…

Linux:docker的Portainer部署

官网 Portainer: Container Management Software for Kubernetes and Dockerhttps://www.portainer.io/ 1.下载 portainer也是一个docker的镜像直接下载即可 docker pull portainer/portainer 2.运行 直接运行镜像即可直接使用 docker run -d -p 8000:8000 -p 9000:9000 -…

Python爬虫之Ajax数据爬取基本原理

爬虫专栏&#xff1a;http://t.csdnimg.cn/WfCSx 前言 有时候我们在用 requests 抓取页面的时候&#xff0c;得到的结果可能和在浏览器中看到的不一样&#xff1a;在浏览器中可以看到正常显示的页面数据&#xff0c;但是使用 requests 得到的结果并没有。这是因为 requests 获…

MySQL 基础知识(九)之视图

目录 1 视图的介绍 2 视图算法 3 创建视图 4 查看视图结构 5 修改视图 6 删除视图 7 参考文档 1 视图的介绍 视图是一张并不存储数据的虚拟表&#xff0c;其本质是根据 SQL 语句动态查询数据库中的数据。数据库中只存放了视图的定义&#xff0c;通过 SQL 语句使用视图时…

基于RHEL8部署Zabbix6.0,监控不再困难!

&#x1f4e2;&#x1f4e2;&#x1f4e2;&#x1f4e3;&#x1f4e3;&#x1f4e3; 哈喽&#xff01;大家好&#xff0c;我是【IT邦德】&#xff0c;江湖人称jeames007&#xff0c;10余年DBA及大数据工作经验 一位上进心十足的【大数据领域博主】&#xff01;&#x1f61c;&am…

java8-使用流-2

筛选各异的元素 流还支持一个叫作aistinct的方法&#xff0c;它会返回一个元素各异(根据流所生成元素的hashcode和eguals方法实现)的流。例如&#xff0c;以下代码会筛选出列表中所有的偶数&#xff0c;并确保没有重复。图5-2直观地显示了这个过程。 List<Integer>number…

通俗易懂的双亲委派机制

当你超过别人一点点&#xff0c;别人会嫉妒你&#xff1b;当你超过别人一大截&#xff0c;别人就会羡慕你 据说给我点关注的都成了大佬&#xff0c;点关注的我都会私发一份好东西 ​​​​你得先知道 在介绍双亲委派机制的时候&#xff0c;不得不提ClassLoader&#xff08;类…

数据结构第3章 串

名人说&#xff1a;莫道桑榆晚&#xff0c;为霞尚满天。——刘禹锡&#xff08;刘梦得&#xff0c;诗豪&#xff09; 本篇笔记整理&#xff1a;Code_流苏(CSDN)&#xff08;一个喜欢古诗词和编程的Coder&#x1f60a;&#xff09; 目录 0、思维导图1、基本概念1&#xff09;主…

在VS里使用C#制作窗口应用

新建项目 创建项目的时候搜索net&#xff0c;选择这个。 打开应该是这样 第一个控件 选择公共控件 - PictureBox - 拖入Form 在Image处选择上传本地资源&#xff0c;建议上传一个小一点的图片。 修改一下尺寸。 ctrls 保存 从“属性”切换到“事件” 双击Click事件…

统计单词数(洛谷)字符串 JAVA

题目描述 一般的文本编辑器都有查找单词的功能&#xff0c;该功能可以快速定位特定单词在文章中的位置&#xff0c;有的还能统计出特定单词在文章中出现的次数。 现在&#xff0c;请你编程实现这一功能&#xff0c;具体要求是&#xff1a;给定一个单词&#xff0c;请你输出它…

1.3.mysql5.7安装包安装

安装包程序 双击安装 勾选后点击【next】 选择第二个默认安装后点击【next】 点击【Execute】 输入密码&#xff08;默认密码&#xff1a;tuners2012&#xff09;&#xff0c;点击【next】

RapidMiner数据挖掘2 —— 初识RapidMiner

本节由一系列练习与问题组成&#xff0c;这些练习与问题有助于理解多个基本概念。它侧重于各种特定步骤&#xff0c;以进行直接的探索性数据分析。因此&#xff0c;其主要目标是测试一些检查初步数据特征的方法。大多数练习都是关于图表技术&#xff0c;通常用于数据挖掘。 为此…

开源软件:推动软件行业繁荣的力量

文章目录 &#x1f4d1;引言开源软件的优势分析开放性与透明度低成本与灵活性创新与协作 开源软件对软件行业的影响推动技术创新和进步促进软件行业的合作与交流培养人才和提高技能促进软件行业的可持续发展 结语 &#x1f4d1;引言 随着信息技术的飞速发展&#xff0c;软件已经…

B端系统从0到1:有几步,其中需求分析要做啥?

一款B系统从无到有都经历了啥&#xff0c;而其中的需求分析又要做什么&#xff1f;贝格前端工场给老铁们做一下分析&#xff0c;文章写作不易&#xff0c;如果咱们有界面设计和前端开发需求&#xff0c;别忘了私信我呦&#xff0c;开始了。 一、B端系统从0到1都有哪些要走的步骤…
推荐文章