Comments (3)
我参考了 https://segmentfault.com/a/1190000020723673 这里写了一个测试 qDebug 的单独一个小程序
#include <QDebug>
#include <QElapsedTimer>
#include <iostream>
#include <QFile>
/* 注:单独打开某个宏测试 */
int main(int argc, char *argv[])
{
QElapsedTimer t;
qint64 it = 0;
t.start();
while (t.elapsed() < 1000) {
qDebug() << "Test1 ==============-----------------===========";
it++;
}
qDebug() << "Test1: " << it;
QFile file("C:/Users/BensonLaur/Desktop/cout.txt");
file.open(QIODevice::WriteOnly | QIODevice::Text);
file.write(QString("count:%0").arg(it).toUtf8());
file.close();
}
该程序做的事是在 1000ms 内计算 it 累加的结果
pro 文件里写了
CONFIG (release, debug|release) {
message("release")
#DEFINES += QT_NO_DEBUG_OUTPUT
}
release 下运行,第一次
运行,会打印,循环打印,并且打印和文件得到值,19344
release 下运行,第二次
解开注释 DEFINES += QT_NO_DEBUG_OUTPUT ,不会打印,文件里得到值 11678307
release 下运行,第三次
再注释回 DEFINES += QT_NO_DEBUG_OUTPUT,然后把循环里的qDebug() 手动注释掉,打印和文件得到值 11926747
from beslyric-for-x.
然后实际运行 B4X 播放一首歌,什么都不做,CPU 稳定在 4.64
附近
接着,因为播放过程只有下面那一句在高频度打印,所以注释掉下面代码中的打印代码
https://github.com/Beslyric-for-X/Beslyric-for-X/blob/8c70c35118771374539570e71228e82df71705e0/BottomWidgets/BottomWidget.cpp#L280-L288
注释后 ,运行软件播放同一首歌,CPU 稳定值在 4.55
附近
from beslyric-for-x.
考虑到release 也要打印,所以还是可以保留 release 下的打印输出,然后注释掉那一行高频打印的代码:
https://github.com/Beslyric-for-X/Beslyric-for-X/blob/8c70c35118771374539570e71228e82df71705e0/BottomWidgets/BottomWidget.cpp#L284
from beslyric-for-x.
Related Issues (20)
- 纠正错误提示“成功失败”,同时优化内容过长而导致显示不全的提示
- 皮肤盒子箭头对不齐,不好看,删掉 HOT 1
- 在程序里标注 BesLyric-for-X 使用的图标来源
- 可以帮您打包到Arch/Manjaro的AUR源里吗 HOT 4
- 完善登录信息的收集 HOT 4
- Migrate from qmake to CMake | 从 qmake 迁移到 CMake
- Remove the source code copied from FFmpeg | 移除从 FFmpeg 复制的源代码
- Introduce TagLib to process the information in audio files | 引入 TagLib 以处理音频文件中的信息
- Analyze the code with tools before committing | 在提交前使用工具分析代码
- Format the code with tools before committing | 在提交前使用工具格式化代码
- Introduce GitHub Actions | 引入 GitHub Actions
- End the support for 32-bit Windows | 停止对 32 位 Windows 的支持
- End the support for macOS 10.13 | 停止对 macOS 10.13 的支持
- Migrate from Qt 5 to Qt 6 | 从 Qt 5 迁移到 Qt 6
- 无法搜索歌曲? HOT 9
- 无法播放部分WAV文件 HOT 4
- wav 格式音乐播放后,没有声音 HOT 1
- flac ape m4a aac 不能通过拖放添加音乐 HOT 2
- 音樂文件導入後,點擊開始製作沒有聲音 HOT 1
- 在俄罗斯使用VPN可以下载国内歌曲,但是无法搜索和下载歌词 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beslyric-for-x.