* ./kite:
- Change: Removed Histogram, moved into crlcore. - Change: In GraphicKiteEngine, add a menu entry to dump the measurments.
This commit is contained in:
parent
a93e5be3da
commit
37d2483443
|
@ -167,7 +167,6 @@ namespace Kite {
|
||||||
|
|
||||||
void GraphicKiteEngine::loadGlobalSolution ()
|
void GraphicKiteEngine::loadGlobalSolution ()
|
||||||
{
|
{
|
||||||
|
|
||||||
KiteEngine* kite = getForFramework ();
|
KiteEngine* kite = getForFramework ();
|
||||||
|
|
||||||
emit cellPreModificated ();
|
emit cellPreModificated ();
|
||||||
|
@ -178,7 +177,6 @@ namespace Kite {
|
||||||
|
|
||||||
void GraphicKiteEngine::globalRoute ()
|
void GraphicKiteEngine::globalRoute ()
|
||||||
{
|
{
|
||||||
|
|
||||||
KiteEngine* kite = getForFramework ();
|
KiteEngine* kite = getForFramework ();
|
||||||
|
|
||||||
emit cellPreModificated ();
|
emit cellPreModificated ();
|
||||||
|
@ -254,6 +252,13 @@ namespace Kite {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicKiteEngine::dumpMeasures ()
|
||||||
|
{
|
||||||
|
KiteEngine* kite = getForFramework ();
|
||||||
|
if ( kite ) kite->dumpMeasures ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicKiteEngine::postEvent ()
|
void GraphicKiteEngine::postEvent ()
|
||||||
{
|
{
|
||||||
static unsigned int count = 0;
|
static unsigned int count = 0;
|
||||||
|
@ -335,6 +340,12 @@ namespace Kite {
|
||||||
dFinalizeAction->setVisible ( true );
|
dFinalizeAction->setVisible ( true );
|
||||||
stepMenu->addAction ( dFinalizeAction );
|
stepMenu->addAction ( dFinalizeAction );
|
||||||
|
|
||||||
|
QAction* dDumpMeasuresAction = new QAction ( tr("Kite - Dump &Measures"), _viewer );
|
||||||
|
dDumpMeasuresAction->setObjectName ( "viewer.menuBar.placeAndRoute.stepBystep.dumpMeasures" );
|
||||||
|
dDumpMeasuresAction->setStatusTip ( tr("Dumping Measurements on the disk") );
|
||||||
|
dDumpMeasuresAction->setVisible ( true );
|
||||||
|
stepMenu->addAction ( dDumpMeasuresAction );
|
||||||
|
|
||||||
QAction* dSaveAction = new QAction ( tr("Kite - &Save Design"), _viewer );
|
QAction* dSaveAction = new QAction ( tr("Kite - &Save Design"), _viewer );
|
||||||
dSaveAction->setObjectName ( "viewer.menuBar.placeAndRoute.stepBystep.save" );
|
dSaveAction->setObjectName ( "viewer.menuBar.placeAndRoute.stepBystep.save" );
|
||||||
dSaveAction->setStatusTip ( tr("Save routed design (temporary hack)") );
|
dSaveAction->setStatusTip ( tr("Save routed design (temporary hack)") );
|
||||||
|
@ -353,6 +364,7 @@ namespace Kite {
|
||||||
connect ( dRouteAction , SIGNAL(triggered()), this, SLOT(detailRoute ()) );
|
connect ( dRouteAction , SIGNAL(triggered()), this, SLOT(detailRoute ()) );
|
||||||
connect ( dFinalizeAction , SIGNAL(triggered()), this, SLOT(finalize ()) );
|
connect ( dFinalizeAction , SIGNAL(triggered()), this, SLOT(finalize ()) );
|
||||||
connect ( dSaveAction , SIGNAL(triggered()), this, SLOT(save ()) );
|
connect ( dSaveAction , SIGNAL(triggered()), this, SLOT(save ()) );
|
||||||
|
connect ( dDumpMeasuresAction, SIGNAL(triggered()), this, SLOT(dumpMeasures ()) );
|
||||||
connect ( routeAction , SIGNAL(triggered()), this, SLOT(route ()) );
|
connect ( routeAction , SIGNAL(triggered()), this, SLOT(route ()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -642,6 +642,8 @@ namespace Kite {
|
||||||
out << "# " << getCell()->getName() << endl;
|
out << "# " << getCell()->getName() << endl;
|
||||||
out << measures->toStringHeaders(measuresLabels) << endl;
|
out << measures->toStringHeaders(measuresLabels) << endl;
|
||||||
out << measures->toStringDatas (measuresLabels) << endl;
|
out << measures->toStringDatas (measuresLabels) << endl;
|
||||||
|
|
||||||
|
measures->toGnuplot ( "GCells Density Histogram", getString(getCell()->getName()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
#include <boost/filesystem/operations.hpp>
|
|
||||||
#include <boost/filesystem/fstream.hpp>
|
|
||||||
namespace bfs = boost::filesystem;
|
|
||||||
|
|
||||||
#include "hurricane/Warning.h"
|
#include "hurricane/Warning.h"
|
||||||
#include "hurricane/Bug.h"
|
#include "hurricane/Bug.h"
|
||||||
#include "hurricane/RoutingPad.h"
|
#include "hurricane/RoutingPad.h"
|
||||||
|
@ -39,6 +35,7 @@ namespace bfs = boost::filesystem;
|
||||||
#include "crlcore/Utilities.h"
|
#include "crlcore/Utilities.h"
|
||||||
#include "crlcore/AllianceFramework.h"
|
#include "crlcore/AllianceFramework.h"
|
||||||
#include "crlcore/Measures.h"
|
#include "crlcore/Measures.h"
|
||||||
|
#include "crlcore/Histogram.h"
|
||||||
#include "katabatic/AutoContact.h"
|
#include "katabatic/AutoContact.h"
|
||||||
#include "katabatic/GCellGrid.h"
|
#include "katabatic/GCellGrid.h"
|
||||||
|
|
||||||
|
@ -63,109 +60,6 @@ namespace {
|
||||||
using namespace Kite;
|
using namespace Kite;
|
||||||
|
|
||||||
|
|
||||||
class Histogram {
|
|
||||||
public:
|
|
||||||
Histogram ( double range, double step, size_t nbSets );
|
|
||||||
~Histogram ();
|
|
||||||
void addSample ( double, size_t iset );
|
|
||||||
void toStream ( ostream& );
|
|
||||||
void toFile ( bfs::path& );
|
|
||||||
void toGnuplot ( string design );
|
|
||||||
void normalize ( double totalSamples, size_t iset );
|
|
||||||
private:
|
|
||||||
double _range;
|
|
||||||
double _step;
|
|
||||||
vector< vector<float> > _sets;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Histogram::Histogram ( double range, double step, size_t nbSets )
|
|
||||||
: _range (range)
|
|
||||||
, _step (step)
|
|
||||||
, _sets ()
|
|
||||||
{
|
|
||||||
size_t binSize = (size_t)rint ( _range / _step );
|
|
||||||
for ( size_t iset=0 ; iset<nbSets ; ++iset ) {
|
|
||||||
_sets.push_back ( vector<float>() );
|
|
||||||
for ( size_t i=0 ; i<binSize ; ++i ) _sets.back().push_back(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Histogram::~Histogram ()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
|
|
||||||
void Histogram::addSample ( double sample, size_t iset )
|
|
||||||
{
|
|
||||||
size_t binIndex = (size_t)rint ( sample / _step );
|
|
||||||
if ( binIndex > _sets.front().size() ) binIndex = _sets.front().size() - 1;
|
|
||||||
|
|
||||||
_sets[iset][binIndex] += 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Histogram::normalize ( double totalSamples, size_t iset )
|
|
||||||
{
|
|
||||||
for ( size_t i=0 ; i<_sets[iset].size() ; ++i ) _sets[iset][i] /= totalSamples;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Histogram::toStream ( ostream& o )
|
|
||||||
{
|
|
||||||
o << setprecision(3);
|
|
||||||
|
|
||||||
for ( size_t i=0 ; i<_sets.front().size() ; ++i ) {
|
|
||||||
for ( size_t iset=0 ; iset<_sets.size() ; ++iset ) {
|
|
||||||
o << _sets[iset][i] << " ";
|
|
||||||
}
|
|
||||||
o << "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Histogram::toFile ( bfs::path& path )
|
|
||||||
{
|
|
||||||
bfs::ofstream fd ( path );
|
|
||||||
toStream ( fd );
|
|
||||||
fd.close ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Histogram::toGnuplot ( string design )
|
|
||||||
{
|
|
||||||
bfs::path datFile = design + ".densityHist.dat";
|
|
||||||
toFile ( datFile );
|
|
||||||
|
|
||||||
bfs::path pltFile = design + ".densityHist.plt";
|
|
||||||
bfs::ofstream fd ( pltFile );
|
|
||||||
|
|
||||||
fd << "set grid\n";
|
|
||||||
fd << "set grid noxtics\n";
|
|
||||||
fd << "set xrange [-0.5:9.5]\n";
|
|
||||||
fd << "set xtics ( ";
|
|
||||||
for ( size_t i=0 ; i<10 ; ++i ) {
|
|
||||||
fd << ((i) ? " ," : "") << "\"<" << ((i+1)*10) << "%%\" " << i;
|
|
||||||
}
|
|
||||||
fd << " )\n";
|
|
||||||
|
|
||||||
fd << "set yrange [0:.4]\n";
|
|
||||||
fd << "set ytics ( ";
|
|
||||||
for ( float i=0.0 ; i<=40.0 ; i+=10.0 ) {
|
|
||||||
fd << ((i != 0.0) ? " ," : "") << "\"" << i << "%%\" " << (i/100.0);
|
|
||||||
}
|
|
||||||
fd << " )\n";
|
|
||||||
|
|
||||||
fd << "set style histogram cluster gap 1\n";
|
|
||||||
fd << "set style fill solid noborder\n";
|
|
||||||
fd << "set boxwidth 1\n";
|
|
||||||
fd << "plot \"" << design << ".densityHist.dat\" using 1 title \"Avg. density\" with histogram linecolor rgb \"green\", \\\n";
|
|
||||||
fd << " \"" << design << ".densityHist.dat\" using 2 title \"Peak. density\" with histogram linecolor rgb \"red\"\n";
|
|
||||||
|
|
||||||
fd.close ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void NegociateOverlapCost ( const TrackElement* segment, TrackCost& cost )
|
void NegociateOverlapCost ( const TrackElement* segment, TrackCost& cost )
|
||||||
{
|
{
|
||||||
Interval intersect = segment->getCanonicalInterval();
|
Interval intersect = segment->getCanonicalInterval();
|
||||||
|
@ -253,6 +147,7 @@ namespace Kite {
|
||||||
using Hurricane::ltracein;
|
using Hurricane::ltracein;
|
||||||
using Hurricane::ltraceout;
|
using Hurricane::ltraceout;
|
||||||
using Hurricane::ForEachIterator;
|
using Hurricane::ForEachIterator;
|
||||||
|
using CRL::Histogram;
|
||||||
using CRL::addMeasure;
|
using CRL::addMeasure;
|
||||||
using Katabatic::AutoContact;
|
using Katabatic::AutoContact;
|
||||||
|
|
||||||
|
@ -497,6 +392,9 @@ namespace Kite {
|
||||||
cmess2.flush();
|
cmess2.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( RoutingEvent::getProcesseds() >= 10 )
|
||||||
|
throw Error ( "Stopped after 10 events." );
|
||||||
|
|
||||||
if ( RoutingEvent::getProcesseds() >= limit ) setInterrupt ( true );
|
if ( RoutingEvent::getProcesseds() >= limit ) setInterrupt ( true );
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -596,23 +494,30 @@ namespace Kite {
|
||||||
addMeasure<size_t>( getCell(), "Events" , RoutingEvent::getProcesseds(), 12 );
|
addMeasure<size_t>( getCell(), "Events" , RoutingEvent::getProcesseds(), 12 );
|
||||||
addMeasure<size_t>( getCell(), "UEvents", RoutingEvent::getProcesseds()-RoutingEvent::getCloneds(), 12 );
|
addMeasure<size_t>( getCell(), "UEvents", RoutingEvent::getProcesseds()-RoutingEvent::getCloneds(), 12 );
|
||||||
|
|
||||||
Histogram densityHistogram ( 1.0, 0.1, 2 );
|
Histogram* densityHistogram = new Histogram ( 1.0, 0.1, 2 );
|
||||||
|
addMeasure<Histogram>( getCell(), "GCells Density Histogram", densityHistogram );
|
||||||
|
|
||||||
|
densityHistogram->setFileExtension ( ".density.histogram" );
|
||||||
|
densityHistogram->setMainTitle ( "GCell Densities" );
|
||||||
|
densityHistogram->setTitle ( "Avg. Density", 0 );
|
||||||
|
densityHistogram->setTitle ( "Peak Density", 1 );
|
||||||
|
densityHistogram->setColor ( "green", 0 );
|
||||||
|
densityHistogram->setColor ( "red" , 1 );
|
||||||
|
|
||||||
const Katabatic::GCellVector* gcells = getKiteEngine()->getGCellGrid()->getGCellVector();
|
const Katabatic::GCellVector* gcells = getKiteEngine()->getGCellGrid()->getGCellVector();
|
||||||
|
|
||||||
getKiteEngine()->getGCellGrid()->setDensityMode ( Katabatic::GCellGrid::AverageHVDensity );
|
getKiteEngine()->getGCellGrid()->setDensityMode ( Katabatic::GCellGrid::AverageHVDensity );
|
||||||
for ( size_t igcell=0 ; igcell<(*gcells).size() ; ++igcell ) {
|
for ( size_t igcell=0 ; igcell<(*gcells).size() ; ++igcell ) {
|
||||||
densityHistogram.addSample ( (*gcells)[igcell]->getDensity(), 0 );
|
densityHistogram->addSample ( (*gcells)[igcell]->getDensity(), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
getKiteEngine()->getGCellGrid()->setDensityMode ( Katabatic::GCellGrid::MaxDensity );
|
getKiteEngine()->getGCellGrid()->setDensityMode ( Katabatic::GCellGrid::MaxDensity );
|
||||||
for ( size_t igcell=0 ; igcell<(*gcells).size() ; ++igcell ) {
|
for ( size_t igcell=0 ; igcell<(*gcells).size() ; ++igcell ) {
|
||||||
densityHistogram.addSample ( (*gcells)[igcell]->getDensity(), 1 );
|
densityHistogram->addSample ( (*gcells)[igcell]->getDensity(), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
densityHistogram.normalize ( (*gcells).size(), 0 );
|
densityHistogram->normalize ( 0 );
|
||||||
densityHistogram.normalize ( (*gcells).size(), 1 );
|
densityHistogram->normalize ( 1 );
|
||||||
densityHistogram.toGnuplot ( getString(getCell()->getName()) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,7 @@ namespace Kite {
|
||||||
void finalize ();
|
void finalize ();
|
||||||
void route ();
|
void route ();
|
||||||
void save ();
|
void save ();
|
||||||
|
void dumpMeasures ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static size_t _references;
|
static size_t _references;
|
||||||
|
|
Loading…
Reference in New Issue