Skip to content
Menu
Open World News Open World News
  • Privacy Policy
Open World News Open World News

Author: Michael G

Andy Wingo: a simple hdr histogram

Posted on December 11, 2023 by Michael G

Good evening! This evening, a note on high-dynamic-range (HDR)
histograms.

problem

How should one record garbage collector pause times?

A few options present themselves: you could just record the total pause
time. Or, also record the total number of collections, which allows you
to compute the average. Maximum is easy enough, too. But then you
might also want the median or the p90 or the p99, and these percentile
values are more gnarly: you either need to record all the pause times,
which can itself become a memory leak, or you need to approximate via a
histogram.

Let’s assume that you decide on the histogram approach. How should you
compute the bins? It would be nice to have microsecond accuracy on the
small end, but if you bin by microsecond you could end up having
millions of bins, which is not what you want. On the other end you
might have multi-second GC pauses, and you definitely want to be able to
record those values.

Consider, though, that it’s not so important to have microsecond
precision for a 2-second pause. This points in a direction of wanting
bins that are relatively close to each other, but whose absolute
separation can vary depending on whether we are measuring microseconds
or milliseconds. You want approximately uniform precision over a high
dynamic range.

logarithmic binning

The basic observation is that you should be able to make a histogram
that gives you, say, 3 significant figures on measured values. Such a
histogram would count anything between 1230 and 1240 in the same bin,
and similarly for 12300 and 12400. The gap between bins increases as
the number of digits grows.

Of course computers prefer base-2 numbers over base-10, so let’s do
that. Say we are measuring nanoseconds, and the maximum number of
seconds we expect is 100 or so. There are about 230
nanoseconds in a second, and 100 is a little less than 27, so
that gives us a range of 37 bits. Let’s say we want a precision of 4
significant base-2 digits, or 4 bits; then we will have one set of
24 bins for 10-bit values, another for 11-bit values, and
so-on, for a total of 37 × 24 bins, or 592 bins. If we use a
32-bit integer count per bin, such a histogram would be 2.5kB or so,
which I think is acceptable.

Say you go to compute the bin for a value. Firstly, note that there are
some values that do not have 4 significant bits: if you record a
measurement of 1 nanosecond, presumably that is just 1 significant
figure. These are like the
denormals in
floating-point numbers. Let’s just say that recording a value val in
[0, 24-1] goes to bin val.

If val is 24 or more, then we compute the major and
minor components. The major component is the number of bits needed to
represent val, minus the 4 precision bits. We can define it like this
in C, assuming that val is a 64-bit value:

#define max_value_bits 37
#define precision 4
uint64_t major = 64ULL - __builtin_clzl(val) - precision;

The 64 - __builtin_clzl(val) gives us the ceiling of the base-2
logarithm of the value. And actually, to take into account the denormal
case, we do this instead:

uint64_t major = val < (1ULL << precision)
  ? 0ULL
  : 64ULL - __builtin_clzl(val) - precision;

Then to get the minor component, we right-shift val by major bits,
unless it is a denormal, in which case the minor component is the value
itself:

uint64_t minor = val < (1 << precision)
  ? val
  : (val >> (major - 1ULL)) & ((1ULL << precision) - 1ULL);

Then the histogram bucket for a given value can be computed directly:

uint64_t idx = (major << precision) | minor;

Of course, we would prefer to bound our storage, hence the consideration
about 37 total bits in 100 seconds of nanoseconds. So let’s do that,
and record any out-of-bounds value in the special last bucket,
indicating that we need to expand our histogram next time:

if (idx >= (max_value_bits << precision))
  idx = max_value_bits << precision;

The histogram itself can then be defined simply as having enough buckets
for all major and minor components in range, plus one for overflow:

struct histogram {
  uint32_t buckets[(max_value_bits << precision) + 1];
};

Getting back the lower bound for a bucket is similarly simple, again
with a case for denormals:

uint64_t major = idx >> precision;
uint64_t minor = idx & ((1ULL << precision) - 1ULL);
uint64_t min_val = major
  ? ((1ULL << precision) | minor) << (major - 1ULL)
  : minor;

y u no library

How many lines of code does something need to be before you will include
it as a library instead of re-implementing? If I am honest with myself,
there is no such limit, as far as code goes at least: only a limit of
time. I am happy to re-implement anything; time is my only enemy. But
strategically speaking, time too is the fulcrum: if I can save time by
re-implementing over integrating a library, I will certainly hack.

The canonical library in this domain is
HdrHistogram. But even
the C port is thousands of lines of code! A histogram should not take
that much code! Hence this blog post today. I think what we have above is sufficient. HdrHistogram’s documentation speaks
in terms of base-10 digits of precision, but that is easily translated
to base-2 digits: if you want 0.1% precision, then in base-2 you’ll need
10 bits; no problem.

I should of course mention that HdrHistogram includes an API that compensates for coordinated
omission
, but I think such an API is straigtforward to build on
top of the basics
.

My code, for what it is worth, and which may indeed be buggy, is over
here
.
But don’t re-use it: write your own. It could be much nicer in C++ or
Rust, or any other language.

Finally, I would note that somehow this feels very basic; surely there
is prior art? I feel like in 2003, Google would have had a better
answer than today; alack. Pointers
appreciated to other references, and if you find them, do tell me more about your search strategy, because mine is inadequate. Until then, gram you later!

Faceless Love (2023) Episode 1 English Subbed

Posted on December 10, 2023 by Michael G

Video by via Dailymotion Source Episode 1 Plot:In this episode, viewers learn about Veekit’s past and the traumatic incident in his childhood that led to the development of prosopagnosia. Now, as a successful adult businessman, Veekit’s colleague Chanon is determined to find a new secretary who can assist him in navigating the challenges posed by…

Especialista analisa conflito territorial em Essequibo: “Maduro segue manual de Putin”

Posted on December 10, 2023 by Michael G

Video by via Dailymotion Source O programa Jornal da Manhã deste domingo (10) recebeu o professor de relações internacionais Gunther Rudzit para analisar o conflito territorial entre Venezuela e Guiana. Neste sábado (09), o presidente Lula conversou com Nicolás Maduro por telefone para mediar uma condução pacífica da tensão em Essequibo. Assista ao programa completo:…

[In Hindi] | Free AMD Xilinx Vivado: Download and Installation on Windows 11 / 10

Posted on December 10, 2023 by Michael G

Video by via Dailymotion Source Dive into the world of Field-Programmable Gate Array (FPGA) development with our step-by-step guide to downloading and installing AMD Xilinx Vivado – all for free! Whether you’re a seasoned developer or a newcomer to FPGA programming, this tutorial is tailored for Windows 11 and 10 users. Learn how to harness…

Olacak O Kadar | Full Arşiv | İlaç Gibi Geldi…

Posted on December 10, 2023 by Michael G

Video by via Dailymotion Source Bölümün Tamamı Saat 19:00’da ‘Olacak O Kadar’ YouTube Kanalında! Olacak O Kadar YouTube Kanalına Abone olmak için http://wedia.link/OlacakOKadarAboneOl linke tıklayabilirsiniz. Levent Kırca ve ekibinin hazırlayıp sunduğu Olacak O Kadar, Levent Kırca’nın yarattığı ve oyuncu kadrosunun başında bulunduğu, 22 yıldır çeşitli Türk televizyon kanallarında yayınlanan ve halkın sorunlarını anlatan bir eleştirel…

How to Design a 7-Segment Display Decoder in VHDL : Learn from Basics

Posted on December 10, 2023 by Michael G

Video by via Dailymotion Source In this informative tutorial, you will learn how to design a 7-segment display decoder using VHDL from the very basics. VHDL (Very High-Speed Integrated Circuit Hardware Description Language) is widely used in digital design and perfect for developing complex digital systems. This step-by-step tutorial aims to provide beginners with a…

Mocaibat, wagi kontra Delgado sa 2023 IHPA Joy Heyball International Open

Posted on December 10, 2023 by Michael G

Video by via Dailymotion Source Mocaibat, wagi kontra Delgado sa 2023 IHPA Joy Heyball International Open Go to Source

How Andrew Tate Got Rich

Posted on December 10, 2023 by Michael G

Author: Source Read more

“I spend five hours painting intricate designs on nails – I charge £95 a set”

Posted on December 10, 2023 by Michael G
An artist spends five hours painting intricate designs on nails, charges £95 a set and has even included a real butterfly’s wings in one design.

Chii Paris, 22, has been painting the stunning designs for just 12 months and already has celebrity clients on her roster after doing American R&B singer SZA’s nails.

She took up the job after deciding to combine the artistic skills she learnt during her fashion degree with working at her mum’s nail salon in Uxbridge, West London.

She spends up to five painstaking hours on each intricate design – which includes 4D poison dart frogs, Spongebob and Winnie the Pooh.

Clients pay anywhere from £50 to £95 to have their nails sculpted with sculpting gels – which Chii calls the nail version of “Play-Doh.”

After deciding on a design and starting the initial sculpture, Chii then cures the nails in between each component.

She then finishes off the nails by painting the sculptures with multiple layers of gel polish.

Her most complex design came when a customer with a love of taxidermy asked her to put real butterfly wings into their nails – which took her a staggering three and a half hours.

Chii, from Uxbridge, West London, said: “That one was a challenge.

“It was great fun though and I like doing things that I haven’t done before, that was the craziest one.

“I don’t actually have a favourite one – I’ve been so lucky to do so many different ones.

“But I enjoy doing the sculptures ones the most – it’s the closest to me being an artist rather than just a nail tech.

“A lot of the sculpture stuff is super last minute – I don’t really know how others work but I’m able to just look at the picture and think I’ll be able to figure it out.

“I don’t do a lot of prepping in that sense, for materials and vision.

“It can be tricky, of course, but when you’ve done similar stuff you can re-apply it.”

Chii launched her business just over a year ago after graduating from WHERE with a fashion marketing degree.

Having already developed her painting skills through her degree, Chii decided to swap the canvas for nails.

She said: “I think that’s why I leant more towards nail art – it gives me an opportunity to showcase my art.

“The style itself was easy to do but going from a canvas to a nail bed wasn’t easy.”

Chii’s designs have proved incredibly popular, with people telling her to up her prices.

She said: “I thought maybe I was underselling myself.

“My perception, considering how long I’ve been doing it, is it’s a bit higher than usual.

“It’s nice to know your work is of value.

“I try to be fair and be considerate and I think it’s something I can charge in the future.

“I need to have a bit more confidence in myself.

“I’ve had thousands of people telling me I could charge a lot more.”

Chii’s work has even caught the eye of celebrities, with American singer-songwriter, SZA paying for a set.

“She was on tour in London, and one of her dancers wanted her nails done,” Chii said.

“But then her manager messaged me 48 hours later saying that SZA herself wanted them done too.

“I’d only been doing nails for a couple of months so it was very unexpected and more so for myself I thought maybe I was good at this.

“They were super block colour, 3D chrome nails.

“Really colourful, every nail was a different colour combo with airbrush contrasting colours.”

My Daddy Dearest: Full Episode 7 (Stream Together)

Posted on December 10, 2023 by Michael G
Bong (Ogie Alcasid) thinks Jessamine is the one who charmed him to get even for what he did to her. Does the curse have a reverse?
  • Previous
  • 1
  • …
  • 705
  • 706
  • 707
  • 708
  • 709
  • 710
  • 711
  • …
  • 1,531
  • Next

Recent Posts

  • [TUT] LoRa & LoRaWAN – MikroTik wAP LR8 kit mit The Things Network verbinden [4K | DE]
  • Mercado aguarda Powell e olha Trump, dados e Haddad | MINUTO TOURO DE OURO – 11/02/25
  • Dan Levy Gets Candid About Learning How To Act Differently After Schitt’s Creek: ‘It’s Physically…
  • Building a Rock Shelter & Overnight Stay in Heavy Snow 🏕️⛰️
  • Les milliardaires Elon Musk et Xavier Niel s’insultent copieusement

Categories

  • Android
  • Linux
  • News
  • Open Source
©2025 Open World News | Powered by Superb Themes
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT