Skip to content

Commit

Permalink
Add high thread usage warning for EPT stages.
Browse files Browse the repository at this point in the history
  • Loading branch information
connormanning committed Mar 5, 2019
1 parent 59f40a0 commit ed36998
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
8 changes: 7 additions & 1 deletion io/EptAddonWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ void EptAddonWriter::addDimensions(PointLayoutPtr layout)
void EptAddonWriter::ready(PointTableRef table)
{
m_arbiter.reset(new arbiter::Arbiter());
m_pool.reset(new Pool(std::max<uint64_t>(m_numThreads, 4)));
const std::size_t threads(std::max<std::size_t>(m_numThreads, 4));
if (threads > 100)
{
log()->get(LogLevel::Warning) << "Using a large thread count: " <<
threads << " threads" << std::endl;
}
m_pool.reset(new Pool(threads));

MetadataNode meta(table.privateMetadata("ept"));

Expand Down
3 changes: 2 additions & 1 deletion io/EptAddonWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#pragma once

#include <cstddef>
#include <memory>

#include <pdal/Writer.hpp>
Expand Down Expand Up @@ -77,7 +78,7 @@ class PDAL_DLL EptAddonWriter : public Writer
void writeHierarchy(Json::Value& hier, const Key& key,
const arbiter::Endpoint& hierEp) const;

uint64_t m_numThreads = 0;
std::size_t m_numThreads = 0;

Dimension::Id m_nodeIdDim = Dimension::Id::Unknown;
Dimension::Id m_pointIdDim = Dimension::Id::Unknown;
Expand Down
8 changes: 7 additions & 1 deletion io/EptReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ void EptReader::initialize()

m_arbiter.reset(new arbiter::Arbiter());
m_ep.reset(new arbiter::Endpoint(m_arbiter->getEndpoint(m_root)));
m_pool.reset(new Pool(m_args.threads()));
const std::size_t threads(m_args.threads());
if (threads > 100)
{
log()->get(LogLevel::Warning) << "Using a large thread count: " <<
threads << " threads" << std::endl;
}
m_pool.reset(new Pool(threads));

debug << "Endpoint: " << m_ep->prefixedRoot() << std::endl;
m_info.reset(new EptInfo(parse(m_ep->get("ept.json"))));
Expand Down
9 changes: 6 additions & 3 deletions io/EptReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,23 @@ class PDAL_DLL EptReader : public Reader

Bounds& boundsArg() { return m_bounds; }
std::string& originArg() { return m_origin; }
uint64_t& threadsArg() { return m_threads; }
std::size_t& threadsArg() { return m_threads; }
double& resolutionArg() { return m_resolution; }
Json::Value& addonsArg() { return *m_addons; }

BOX3D bounds() const;
std::string origin() const { return m_origin; }
uint64_t threads() const { return std::max<uint64_t>(4, m_threads); }
std::size_t threads() const
{
return std::max<std::size_t>(4, m_threads);
}
double resolution() const { return m_resolution; }
const Json::Value& addons() const { return *m_addons; }

private:
Bounds m_bounds;
std::string m_origin;
uint64_t m_threads = 0;
std::size_t m_threads = 0;
double m_resolution = 0;
std::unique_ptr<Json::Value> m_addons;
};
Expand Down

0 comments on commit ed36998

Please sign in to comment.