我是kubernetes的新手.我在pod中有一个问题.当我运行命令
kubectl get pods
Run Code Online (Sandbox Code Playgroud)
结果:
NAME READY STATUS RESTARTS AGE
mysql-apim-db-1viwg 1/1 Running 1 20h
mysql-govdb-qioee 1/1 Running 1 20h
mysql-userdb-l8q8c 1/1 Running 0 20h
wso2am-default-813fy 0/1 ImagePullBackOff 0 20h
Run Code Online (Sandbox Code Playgroud)
由于"wso2am-default-813fy"节点的问题,我需要重新启动它.有什么建议吗?
我在高中,计算机培训机构等教授C++约两年.在教授了关于变量,数组,结构,函数的基础知识后,我总是以传统的例子开始面向对象的例子,如下所示:
class Person {
public:
Person();
~Person();
char* getFirstName(); //we can use std::string instead of char* in optimization part
char* getLastName();
char* getFullName();
int getAge();
bool getGender();
void printFullProfile();
void setFirstName(char*);
void setLastName(char*);
void setAge(unsigned int);
void setGender(bool);
void setGender(char);//f for female, m for male.
private:
char* first_name; //or std::string but i prefer to use pointers in the beginning.
char* last_name;
unsigned int age;
bool gender; //ladies 1(st) , male 0
}
Run Code Online (Sandbox Code Playgroud)
然后完成这个Person类并教导新的东西,例如为什么getter和setter方法是邪恶的,并通过创建其他类(如学生,员工,主持人等)避免访问器,继承,多态,必要的OOP技能和概念.
[编辑]:并使这些类有助于解决编程问题.(比如计算每个Employee对象的工资,学生标记平均值,以及许多其他人)
另一个基本的例子是Vehicle类,Shape类等. …
我正在做SWF应用程序,它将在浏览器中运行.我想CTRL+F在Flex应用程序聚焦时捕获按键事件.
在Firefox中它工作正常,但在Opera和Safari浏览器中捕获Flex应用程序和查找对话框弹出窗口之前的事件.
有没有办法让flex应用程序捕获CTRL+F事件先前的浏览器?
我正在开发一个需要低分辨率和大约110 fps的项目.所以我买了30美元的PlayStation眼睛,在240分辨率下提供120 fps的320分辨率.
我安装的MACAM以前的版本(因为最新的版本不工作),并顺利拿到约120 FPS(但我不能,因为在MACAM一些错误的记录).

我写了一个简单的代码将每个帧保存为jpg文件:
#include <stdio.h>
#include "cv.h"
#include "highgui.h"
#include<iostream>
using namespace std;
int main(int argc, char** argv) {
int i = 0;
char *buf;
IplImage *frame;
CvCapture* capture = cvCreateCameraCapture(3);
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, 320);
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, 240);
cvSetCaptureProperty( capture, CV_CAP_PROP_FPS, 110);
while (true) {
frame = cvQueryFrame(capture);
asprintf(&buf, "%d.jpg", i++);
cvShowImage("1", frame);
cvSaveImage(buf, frame);
cvWaitKey(10);
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但它每秒只能节省30帧.我的意思是它创建30个文件而不是每秒110个文件.有什么问题 ?
更新:我使用以下命令编译上面的代码:
g++ main.cpp `pkg-config --cflags opencv` `pkg-config --libs opencv` -o exec -m32
Run Code Online (Sandbox Code Playgroud) 我将 nodejs 应用程序(作为服务器)部署为 Docker 容器,我想在调用其中的函数时计算已执行指令的数量。
以下是我如何找到容器的 PID:
$ pstree -p | grep node | grep npm
| |-containerd-shim(114397)-+-npm(114414)-+-sh(114540)---node(114541)-+-{node}(114542)
Run Code Online (Sandbox Code Playgroud)
然后,我需要知道 Docker ID:
$ docker ps | grep workload
root@node3:/home/m# docker ps | grep workload | grep npm
c7457f74536b michelgokan/synthetic-workload-generator "npm start" 55 minutes ago Up 55 minutes k8s_whatever_workload-5697bb48f9-gg8j5_default_896e5938-55f2-4875-bf6c-2bff2acbe0c6_0
Run Code Online (Sandbox Code Playgroud)
现在,我知道父 PID 是 114397。所以我运行以下perf命令:
$ perf stat -p 114397 -e instructions,cycles,task-clock docker exec -it c7457f74536b curl 127.0.0.1:30005/workload/cpu
1000 CHKSM AND DIFFIEHELLMAN 60 OK!
Performance counter stats for process id '114397':
170057460 …Run Code Online (Sandbox Code Playgroud) 假设我有一个软件,并且想要使用黑盒方法研究其行为。我有一个 3.0GHz CPU,有 2 个插槽和 4 个核心。如您所知,为了找出每秒指令数 (IPS),我们必须使用以下公式:
IPS = sockets*(cores/sockets)*clock*(instructions/cycle)
Run Code Online (Sandbox Code Playgroud)
首先,我想找到我的特定算法每个周期的指令数。然后我意识到使用块盒方法几乎不可能计算它,我需要对算法进行深入分析。
但现在,我有两个问题:无论我的机器上运行什么类型的软件及其CPU使用率,有没有办法计算每秒发送到CPU的指令数(每秒百万条指令(MIPS))?是否有可能找到指令集的类型(添加、比较、输入、跳转等)?
任何脚本或工具推荐都将受到赞赏(任何语言)。
我正在尝试在 Ubuntu 中使用 Vue CLI 创建一个 Vue 项目,但一直出现相同的错误。我已经使用sudo npm i -g @vue/cli.
这是错误消息:
00h00m00s 0/0: : 错误错误: 命令失败: yarn config get registry 错误: [Errno 2] 没有这样的文件或目录: 'config'
错误:命令失败:yarn config get registry
错误:[Errno 2] 没有这样的文件或目录:'config'
at makeError (/usr/local/lib/node_modules/@vue/cli/node_modules/execa/index.js:174:9) at Promise.all.then.arr (/usr/local/lib/node_modules/@vue/ cli/node_modules/execa/index.js:278:16) 在 processTicksAndRejections (internal/process/next_tick.js:81:5)
这是什么原因?
前段时间,我问了以下问题“如何计算进程 id 的执行指令数(包括子进程)”,@M-Iduoad 好心提供了一个解决方案来pgrep捕获所有子 PID 并将其与 perf stat 中的 -p 一起使用。效果很好!
然而,我遇到的一个问题是多线程应用程序以及当生成新线程时。由于我不是算命先生(太糟糕了!),我不知道tid新生成的线程,因此我无法将它们添加到perf stat-p 或 -t 参数中。
举个例子,假设我有一个多线程 Nodejs 服务器(作为容器部署在 Kubernetes 之上),具有以下内容pstree:
root@node2:/home/m# pstree -p 4037791\nnode(4037791)\xe2\x94\x80\xe2\x94\xac\xe2\x94\x80sh(4037824)\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80node(4037825)\xe2\x94\x80\xe2\x94\xac\xe2\x94\x80{node}(4037826)\n \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80{node}(4037827)\n \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80{node}(4037828)\n \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80{node}(4037829)\n \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80{node}(4037830)\n \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80{node}(4037831)\n \xe2\x94\x9c\xe2\x94\x80{node}(4037805)\n \xe2\x94\x9c\xe2\x94\x80{node}(4037806)\n \xe2\x94\x9c\xe2\x94\x80{node}(4037807)\n \xe2\x94\x9c\xe2\x94\x80{node}(4037808)\n \xe2\x94\x9c\xe2\x94\x80{node}(4037809)\n \xe2\x94\x9c\xe2\x94\x80{node}(4037810)\n \xe2\x94\x9c\xe2\x94\x80{node}(4037811)\n \xe2\x94\x9c\xe2\x94\x80{node}(4037812)\n \xe2\x94\x9c\xe2\x94\x80{node}(4037813)\n \xe2\x94\x94\xe2\x94\x80{node}(4037814) \nRun Code Online (Sandbox Code Playgroud)\n当然,我可以使用以下perf stat命令来观察其线程:
perf stat --per-thread -e instructions,cycles,task-clock,cpu-clock,cpu-migrations,context-switches,cache-misses,duration_time -p $(pgrep --ns 4037791 | paste -s -d ",")\nRun Code Online (Sandbox Code Playgroud)\n … 此代码是否会造成任何内存泄漏?或者代码有什么问题吗?
HTML:
<div id='info'></div>
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
var count = 0;
function KeepAlive()
{
count++;
$('#info').html(count);
var t=setTimeout(KeepAlive,1000);
}
KeepAlive();
Run Code Online (Sandbox Code Playgroud)
在这里运行测试:http: //jsfiddle.net/RjGav/
performance ×3
c++ ×2
docker ×2
linux ×2
perf ×2
profiling ×2
actionscript ×1
apache-flex ×1
assembly ×1
benchmarking ×1
camera ×1
coreos ×1
cpu ×1
javascript ×1
kubernetes ×1
macos ×1
npm ×1
oop ×1
opencv ×1
settimeout ×1
vue-cli-3 ×1
vue.js ×1