-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from zz85/faster_scanning
Faster scanning
- Loading branch information
Showing
12 changed files
with
735 additions
and
503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
path { | ||
stroke: #fff; | ||
fill-rule: evenodd; | ||
} | ||
|
||
|
||
circle, | ||
path { | ||
|
||
} | ||
|
||
circle { | ||
fill: none; | ||
pointer-events: all; | ||
} | ||
|
||
circle:hover { | ||
fill: #999; | ||
opacity: 0.5; | ||
} | ||
|
||
#core:hover { | ||
opacity: 0.5; | ||
cursor: pointer; | ||
} | ||
|
||
|
||
/* treemap */ | ||
|
||
rect { | ||
fill: none; | ||
pointer-events: all; | ||
} | ||
|
||
pre { | ||
font-size: 18px; | ||
} | ||
|
||
line { | ||
stroke: #000; | ||
stroke-width: 1.5px; | ||
} | ||
|
||
.string, .regexp { | ||
color: #f39; | ||
} | ||
|
||
.keyword { | ||
color: #00c; | ||
} | ||
|
||
.comment { | ||
color: #777; | ||
font-style: oblique; | ||
} | ||
|
||
.number { | ||
color: #369; | ||
} | ||
|
||
.class, .special { | ||
color: #1181B8; | ||
} | ||
|
||
/* end treemap */ | ||
|
||
body { | ||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
margin: auto; | ||
position: relative; | ||
overflow: none; | ||
} | ||
|
||
.cell > rect:hover { | ||
fill: yellow; | ||
} | ||
|
||
/* legend */ | ||
|
||
#explanation { | ||
font-family: Avenir, Arial, Helvetica, sans-serif; | ||
position: absolute; | ||
/*top: 260px; | ||
left: 305px*/; | ||
width: 140px; | ||
height: 140px; | ||
margin: auto; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
text-align: center; | ||
color: #333; | ||
z-index: -1; | ||
/*z-index: -1;*/ | ||
} | ||
|
||
#core_top { | ||
/*font-size: 2.5em;*/ | ||
} | ||
|
||
#core_center { | ||
font-size: 2em; | ||
} | ||
|
||
|
||
#legend { | ||
text-align:center; | ||
font-family: Avenir, Arial, Helvetica, sans-serif; | ||
padding-top:20px; | ||
position: absolute; | ||
left: 0; | ||
right: 0; | ||
top: 40px; | ||
z-index: 50; | ||
} | ||
|
||
#legend h2 { | ||
font-size:1.2em; | ||
font-style:inherit; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
#legend p { | ||
font-size:.9em; | ||
margin: 0; | ||
padding: 0; | ||
text-transform: uppercase; | ||
font-variant:small-caps; | ||
} | ||
|
||
#loading { | ||
left: 0; | ||
right: 0; | ||
top: 0; | ||
bottom: 0; | ||
position: fixed; | ||
display: inline-block; | ||
margin: auto; | ||
z-index: 10; | ||
width: 100px; | ||
height: 100px; | ||
display: none; | ||
} | ||
|
||
.hmm { | ||
opacity: 0.8; | ||
cursor: pointer; | ||
} | ||
|
||
.hmm:hover { | ||
stroke: #999; | ||
stroke-width: 2px; | ||
opacity: 1; | ||
} | ||
|
||
.svg-container { | ||
display: inline-block; | ||
position: relative; | ||
width: 100%; | ||
/*padding-bottom: 100%;*/ /* aspect ratio */ | ||
vertical-align: top; | ||
overflow: hidden; | ||
} | ||
|
||
.svg-content-responsive { | ||
display: inline-block; | ||
position: absolute; | ||
top: 10px; | ||
left: 0; | ||
} | ||
|
||
#sequence { | ||
position: absolute; | ||
bottom: 0; | ||
left: 0; | ||
z-index: 100; | ||
/*width: 600px; | ||
height: 70px;*/ | ||
} | ||
|
||
|
||
#chart { | ||
position: relative; | ||
} | ||
|
||
#chart path { | ||
stroke: #fff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<html> | ||
<head> | ||
<title>DU headless</title> | ||
</head> | ||
<body> | ||
<script> | ||
|
||
'use strict'; | ||
|
||
const path = require('path') | ||
const ipc = require('ipc') | ||
const du = require('./js/du') | ||
|
||
const ipc_name = 'du' | ||
ipc.send('register', ipc_name) | ||
|
||
ipc.on('ready', function() { | ||
console.log('all is ready') | ||
go(); | ||
}) | ||
|
||
ipc.on('broadcast', function(arg) { | ||
console.log('[' + ipc_name + '] broadcast', arg) | ||
}) | ||
|
||
ipc.on('message', function(arg) { | ||
console.log('[' + ipc_name + '] message', arg) | ||
}) | ||
|
||
function go() { | ||
|
||
let target = '../../..' | ||
var INCREMENTAL_INTERVAL = 30000 | ||
|
||
let checker | ||
let json = {} | ||
console.time('async2') | ||
|
||
function complete(counter) { | ||
// console.log("Scan completed", counter, "files"); | ||
console.timeEnd('async2') | ||
clearTimeout(checker) | ||
|
||
console.log(json); | ||
|
||
// cache | ||
// console.time('write') | ||
// fs.writeFileSync('test.json', JSON.stringify(json)) | ||
// console.timeEnd('write') | ||
|
||
ipc.send('call', 'viz', 'complete', json) | ||
}; | ||
|
||
function refresh() { | ||
clearTimeout(checker) | ||
console.log('scanning...'); | ||
|
||
ipc.send('call', 'viz', 'refresh', json) | ||
checker = setTimeout(refresh, INCREMENTAL_INTERVAL) | ||
} | ||
|
||
function progress(path, name) { | ||
ipc.send('call', 'viz', 'progress', path, name) | ||
} | ||
|
||
target = path.resolve(target) | ||
console.log('Scanning target', target) | ||
|
||
// yay | ||
du({ | ||
parent: target, | ||
node: json, | ||
onprogress: progress, | ||
// onrefresh: refresh | ||
}, complete) | ||
|
||
setTimeout(refresh, 5000) | ||
} | ||
|
||
|
||
// // d3.json("flare.json", onJson); | ||
// // for testing purposes only | ||
// // json = fs.readFileSync('user.json', { encoding: 'utf-8'}) | ||
// // loading.style.display = 'none' | ||
// // onJson(null, JSON.parse(json).children[10]) | ||
// // onJson(null, JSON.parse(json)) | ||
// }) | ||
|
||
|
||
</script> | ||
<script> | ||
// // redirect log to stdout | ||
// console.log = require('console').log | ||
// // redirect errors to stderr | ||
// window.addEventListener('error', function (e) { | ||
// e.preventDefault() | ||
// require('console').error(e.error.stack || 'Uncaught ' + e.error) | ||
// }) | ||
|
||
// ipc.on('args', function (args) { | ||
// console.log('yoz i got something!!!') | ||
// // var app | ||
// // if (path.isAbsolute(args[2])) { | ||
// // app = require(args[2]) | ||
// // } else { | ||
// // app = require(path.join(process.cwd(), args[2])) | ||
// // } | ||
// // if (typeof app === 'function') app(args.slice(2)) | ||
// }) | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.