“a586069b0f56a700d6f6249a64cbc313dd4a97e0”上不存在“drivers/scsi/git@gitcode.net:openanolis/cloud-kernel.git”
提交 69c20875 编写于 作者: J Jason Park

remove _pace method, add interval interface instead

上级 5442583e
...@@ -15,13 +15,16 @@ a { ...@@ -15,13 +15,16 @@ a {
} }
* { * {
color: inherit;
}
*:not(input) {
-webkit-touch-callout: none; -webkit-touch-callout: none;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
-o-user-select: none; -o-user-select: none;
user-select: none; user-select: none;
color: inherit;
} }
button { button {
...@@ -85,6 +88,14 @@ nav h3 { ...@@ -85,6 +88,14 @@ nav h3 {
height: 100%; height: 100%;
} }
button input {
outline: none;
background: none;
border: none;
width: 20px;
text-align: right;
}
.sidemenu { .sidemenu {
top: 30px; top: 30px;
bottom: 0; bottom: 0;
...@@ -252,6 +263,11 @@ pre { ...@@ -252,6 +263,11 @@ pre {
background: rgba(120, 0, 0, .8); background: rgba(120, 0, 0, .8);
} }
.toast.info {
border-color: rgb(0, 150, 0);
background: rgba(0, 120, 0, .8);
}
.github-fork-ribbon { .github-fork-ribbon {
position: fixed; position: fixed;
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<button id="btn_prev"><i class="fa fa-chevron-left" aria-hidden="true"></i> Prev</button> <button id="btn_prev"><i class="fa fa-chevron-left" aria-hidden="true"></i> Prev</button>
<button id="btn_pause"><i class="fa fa-pause" aria-hidden="true"></i> Pause</button> <button id="btn_pause"><i class="fa fa-pause" aria-hidden="true"></i> Pause</button>
<button id="btn_next">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></button> <button id="btn_next">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></button>
<button id="btn_interval">Interval: <input type="text" value="0.5"> sec</button>
</div> </div>
</nav> </nav>
<section class="sidemenu active"> <section class="sidemenu active">
......
...@@ -4,7 +4,6 @@ var stepLimit = 1e6; ...@@ -4,7 +4,6 @@ var stepLimit = 1e6;
var Tracer = function (module) { var Tracer = function (module) {
this.module = module || Tracer; this.module = module || Tracer;
this.traces = []; this.traces = [];
this.traceOptions = null;
this.traceIndex = -1; this.traceIndex = -1;
this.stepCnt = 0; this.stepCnt = 0;
this.capsule = tm.allocate(this); this.capsule = tm.allocate(this);
...@@ -49,18 +48,11 @@ Tracer.prototype = { ...@@ -49,18 +48,11 @@ Tracer.prototype = {
_print: function (msg, delay) { _print: function (msg, delay) {
this.pushStep({type: 'print', msg: msg}, delay); this.pushStep({type: 'print', msg: msg}, delay);
}, },
_pace: function (interval) {
this.pushStep({type: 'pace', interval: interval}, false);
},
_clear: function () { _clear: function () {
this.pushStep({type: 'clear'}, true); this.pushStep({type: 'clear'}, true);
}, },
visualize: function (options) { visualize: function () {
options = options || {};
options.interval = options.interval || 500;
$('#btn_trace').click(); $('#btn_trace').click();
this.traceOptions = options;
this.traceIndex = -1; this.traceIndex = -1;
this.resumeStep(); this.resumeStep();
}, },
...@@ -92,9 +84,6 @@ Tracer.prototype = { ...@@ -92,9 +84,6 @@ Tracer.prototype = {
case 'print': case 'print':
tracer.printTrace(step.msg); tracer.printTrace(step.msg);
break; break;
case 'pace':
tracer.traceOptions.interval = step.interval;
break;
case 'clear': case 'clear':
tracer.clear(); tracer.clear();
tracer.printTrace('clear traces'); tracer.printTrace('clear traces');
...@@ -105,12 +94,12 @@ Tracer.prototype = { ...@@ -105,12 +94,12 @@ Tracer.prototype = {
}); });
if (!options.virtual) { if (!options.virtual) {
this.refresh(); this.refresh();
this.scrollToEnd(Math.min(50, this.traceOptions.interval)); this.scrollToEnd(Math.min(50, tm.interval));
} }
if (tm.pause) return; if (tm.pause) return;
timer = setTimeout(function () { timer = setTimeout(function () {
tracer.step(i + 1, options); tracer.step(i + 1, options);
}, sleepDuration || this.traceOptions.interval); }, sleepDuration || tm.interval);
}, },
refresh: function () { refresh: function () {
}, },
......
var TracerManager = function () { var TracerManager = function () {
this.pause = false; this.pause = false;
this.capsules = []; this.capsules = [];
this.interval = 500;
}; };
TracerManager.prototype = { TracerManager.prototype = {
...@@ -28,7 +29,6 @@ TracerManager.prototype = { ...@@ -28,7 +29,6 @@ TracerManager.prototype = {
return false; return false;
} }
}); });
console.log('allocated ' + selectedCapsule);
if (selectedCapsule == null) { if (selectedCapsule == null) {
selectedCapsule = this.add(newTracer); selectedCapsule = this.add(newTracer);
} }
...@@ -78,5 +78,8 @@ TracerManager.prototype = { ...@@ -78,5 +78,8 @@ TracerManager.prototype = {
}, },
isPause: function () { isPause: function () {
return this.pause; return this.pause;
},
setInterval: function (interval) {
$('#btn_interval input').val(interval);
} }
}; };
\ No newline at end of file
...@@ -10,6 +10,11 @@ $(document).on('click', 'a', function (e) { ...@@ -10,6 +10,11 @@ $(document).on('click', 'a', function (e) {
var tm = new TracerManager(); var tm = new TracerManager();
$('#btn_interval input').on('change', function () {
tm.interval = Number.parseFloat($(this).val() * 1000);
showInfoToast('Tracing interval has been set to ' + tm.interval / 1000 + ' second(s).');
});
var $module_container = $('.module_container'); var $module_container = $('.module_container');
var initEditor = function (id) { var initEditor = function (id) {
var editor = ace.edit(id); var editor = ace.edit(id);
...@@ -193,6 +198,16 @@ var showErrorToast = function (err) { ...@@ -193,6 +198,16 @@ var showErrorToast = function (err) {
}, 3000); }, 3000);
}; };
var showInfoToast = function (info) {
var $toast = $('<div class="toast info">').append(info);
$('.toast_container').append($toast);
setTimeout(function () {
$toast.fadeOut(function () {
$toast.remove();
});
}, 3000);
};
$('#btn_run').click(function () { $('#btn_run').click(function () {
try { try {
tm.deallocateAll(); tm.deallocateAll();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册