我遇到了lcov的性能问题.
我正在七个不同的配置文件中执行一个程序,收集每个配置文件的覆盖范围,然后将覆盖配置文件与lcov合并:
lcov --rc lcov_branch_coverage=1 -a coverage_1.dat -a coverage_2.dat -a coverage_3.dat -a coverage_4.dat -a coverage_5.dat -a coverage_6.dat -a coverage_7.dat -o coverage_full.dat
Run Code Online (Sandbox Code Playgroud)
然而,这非常缓慢.组合我的7个配置文件大约需要10分钟,这实际上比编译和运行7个配置文件要长.每个dat文件大约有1M行.
在lcov --combine和lcov --remove步骤非常缓慢的为好.每个人大约45秒.
有没有办法加快这个组合步骤?如果需要我可以使用几个线程,我有足够的内存.如果有其他工具能够正确地进行这种组合,我也会感兴趣(我已经尝试将文件转换为Cobertura并使用我发现的Python脚本进行合并,但它崩溃了).
如果完全有替代lcov,我也很感兴趣.我一直在使用gcovr,但有了它,我必须使用其他几种工具来进行组合并且它不是最佳的,但速度要快得多.
我有一个带指定访问键的经典菜单.
问题:使用按Alt+ E(编辑菜单),然后按住Alt他按下F.他希望选择子菜单Edit - > Form,而是打开上级菜单File.
如果他发布Alt- 一切都会好的.
同时Visual Studio在这种情况下表现得非常正确.
有任何想法吗 ?
谢谢!
upd: 我觉得VS使用AccessKeyManager作用域.
我是Ubuntu的新手.我试着编译一个简单的"Hello World!" Ubuntu 11.04中的c ++代码,带有该代码(在终端中):
gcc -Wall -W -Werror tex.cpp -o tex.
Run Code Online (Sandbox Code Playgroud)
但编译器返回了很多错误:
/tmp/ccL8c1p8.o: In function `main':
tex.cpp:(.text+0xa): undefined reference to `std::cout'
tex.cpp:(.text+0xf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccL8c1p8.o: In function `__static_initialization_and_destruction_0(int, int)':
tex.cpp:(.text+0x3d): undefined reference to `std::ios_base::Init::Init()'
tex.cpp:(.text+0x42): undefined reference to `std::ios_base::Init::~Init()'
collect2: ld returned 1 exit status
mohrd@mio:~$ gcc -Wall -W -Werror tex.cpp -o tex.
/tmp/ccEke5JP.o: In function `main':
tex.cpp:(.text+0xa): undefined reference to `std::cout'
tex.cpp:(.text+0xf): undefined reference to `std::basic_ostream<char, std::char_traits<char> …Run Code Online (Sandbox Code Playgroud) 我知道这个问题已被问过很多次,但我在这里找不到解决方案,也没有在谷歌找到解决方案.
这是我的头文件
#ifndef MAINCONTROLLER_H
#define MAINCONTROLLER_H
#include <QSettings>
#include <QDebug>
#include <QDir>
#include <QObject>
#include "PhTools/PhString.h"
#include "PhStrip/PhStripDoc.h"
class MainController : public QObject
{
Q_OBJECT
public:
explicit MainController(QObject *parent = 0);
void loadSettings();
PhString getLastFile();
void setLastFile(PhString fileName);
bool openDoc(PhString fileName);
signals:
void docChanged();
private:
QSettings * _settings;
PhStripDoc * _doc;
};
#endif // MAINCONTROLLER_H
Run Code Online (Sandbox Code Playgroud)
我的CPP档案:
#include "MainController.h"
MainController::MainController(QObject *parent) :
QObject(parent)
{
_doc = new PhStripDoc();
loadSettings();
}
void MainController::loadSettings()
{
_settings = new QSettings(QDir::homePath() + "/Library/Preferences/com.me.me.plist", QSettings::NativeFormat);
getLastFile(); …Run Code Online (Sandbox Code Playgroud) 我有这个代码:
var contractsID = contracts.Select(x => x.Id);
int?[] contractsIDList = contractsID.ToArray();//for debug
Run Code Online (Sandbox Code Playgroud)
在这一行:
int?[] contractsIDList = contractsID.ToArray();//for debug
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
无法将int []类型隐式转换为int
我尝试做的是使contractIDList为Nullable类型.
如何使int数组为Nullable?
我是自学C++和Bjarne Stroustrup的"Programming-Principles and Practices Using C++"一书.其中一个"试试这个"问:
在不使用乘法运算符的情况下实现square(); 也就是说,通过重复添加来执行x*x(在0处开始变量结果并将x添加到x次).然后使用该square()运行某个版本的"第一个程序".
基本上,我需要创建一个square(int x)函数,它将返回它的平方而不使用乘法运算符.到目前为止我有这个:
int square(int x)
{
int i = 0;
for(int counter = 0; counter < x; ++counter)
{
i = i + x;
}
return i;
}
Run Code Online (Sandbox Code Playgroud)
但我想知道是否有更好的方法来做到这一点.上述功能有效,但我非常确定这不是最好的方法.有帮助吗?
我遇到的问题与OpenGl太暗但问题完全不同,但答案对我不起作用.我试图通过转换为纹理的表面来显示图像,结果太暗了:
原版的:
在openGL之后

左边是原版,右边是OpenGl img.
这是我的代码:
void TexturedRect::draw(int scroll){
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glBindTexture(GL_TEXTURE_2D, _texture);
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS); //Begining the cube's drawing
int x = this->getX();
int y = this->getY();
int w = this->getWidth();
int h = this->getHeight();
int z = this->getZ();
/*
(0,0) ------ (1,0)
| |
| |
(0,1) ------ (1,1)
*/
glTexCoord3i(0, 0, 1);glVertex3i(x + scroll, y, z);
glTexCoord3i(_tv, 0, 1);glVertex3i(x + w * _tv + scroll, y, z);
glTexCoord3i(_tv, _tu, 1);glVertex3i(x + w * _tv + scroll, …Run Code Online (Sandbox Code Playgroud) 我使用a Dictionary<string, Test>来存储一些数据,其中键是文件路径.为了显示这个字典,我创建了一个树视图,节点名称是相应测试的关键.
当我尝试取回一个值时,我使用:
Test test = Tests[node.Name];
Run Code Online (Sandbox Code Playgroud)
但我告诉我:
给定的密钥不在字典中.
所以我做了一些手动调试:
Console.WriteLine(node.Name + Environment.NewLine + Tests.First().Key);
Run Code Online (Sandbox Code Playgroud)
哪个输出:
P:\poolman\LY21\2015\LY21_2015-03-25_03.xml <- The node name
P:\poolman\LY21\2015\LY21_2015-03-25_03.xml <- The dictionary first key
Run Code Online (Sandbox Code Playgroud)
但是继续崩溃.我怎么能摆脱这个?
我已经添加
Console.WriteLine(node.Name.Length + " " + Tests.First().Key.Length);
Run Code Online (Sandbox Code Playgroud)
哪个输出
43 43
Run Code Online (Sandbox Code Playgroud)
所以这不是长度.
在立即窗口中我尝试了这个:
node.Name == Tests.First().Key
true
Run Code Online (Sandbox Code Playgroud)
我真的不明白.
Tests.ContainsKey(node.Name)
true
Run Code Online (Sandbox Code Playgroud) 序言:我正在改变一些代码(在数组中手动Max搜索)到一些Linq.Max()超级性感的书写行,这让我对性能提出了问题(我经常处理大数组).所以我做了一个小程序来测试,因为我只相信我所看到的并得到了这个结果:
The size is now of 1 elements
With the loop it took: 00:00:00.0000015
With Linq it took: 00:00:00.0000288
The loop is faster: 94,79%
-----------------------------------------
The size is now of 10 elements
With the loop it took: 00:00:00
With Linq it took: 00:00:00.0000007
The loop is faster: 100,00%
-----------------------------------------
The size is now of 100 elements
With the loop it took: 00:00:00
With Linq it took: 00:00:00.0000011
The loop is faster: 100,00%
-----------------------------------------
The size is now of …Run Code Online (Sandbox Code Playgroud) 我需要使用新语法向Javascript类添加方法.我试过这种方式:
class X{
constructor() {
this.a = 'b'
}
x(){
}
}
X.prototype.y = function (){
console.log('y')
}
var x = new X()
x.y()
console.log(X) // print the the class but not the new method.
Run Code Online (Sandbox Code Playgroud)
它只是打印:
class X{
constructor() {
this.a = 'b'
}
x(){}
}
Run Code Online (Sandbox Code Playgroud)
但我期待
class X{
constructor() {
this.a = 'b'
}
x(){}
y(){
console.log('y');
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能在Javascript类中添加新方法?