• Guest
HabraHabr
  • Main
  • Users

  • Development
    • Programming
    • Information Security
    • Website development
    • JavaScript
    • Game development
    • Open source
    • Developed for Android
    • Machine learning
    • Abnormal programming
    • Java
    • Python
    • Development of mobile applications
    • Analysis and design of systems
    • .NET
    • Mathematics
    • Algorithms
    • C#
    • System Programming
    • C++
    • C
    • Go
    • PHP
    • Reverse engineering
    • Assembler
    • Development under Linux
    • Big Data
    • Rust
    • Cryptography
    • Entertaining problems
    • Testing of IT systems
    • Testing Web Services
    • HTML
    • Programming microcontrollers
    • API
    • High performance
    • Developed for iOS
    • CSS
    • Industrial Programming
    • Development under Windows
    • Image processing
    • Compilers
    • FPGA
    • Professional literature
    • OpenStreetMap
    • Google Chrome
    • Data Mining
    • PostgreSQL
    • Development of robotics
    • Visualization of data
    • Angular
    • ReactJS
    • Search technologies
    • Debugging
    • Test mobile applications
    • Browsers
    • Designing and refactoring
    • IT Standards
    • Solidity
    • Node.JS
    • Git
    • LaTeX
    • SQL
    • Haskell
    • Unreal Engine
    • Unity3D
    • Development for the Internet of things
    • Functional Programming
    • Amazon Web Services
    • Google Cloud Platform
    • Development under AR and VR
    • Assembly systems
    • Version control systems
    • Kotlin
    • R
    • CAD/CAM
    • Customer Optimization
    • Development of communication systems
    • Microsoft Azure
    • Perfect code
    • Atlassian
    • Visual Studio
    • NoSQL
    • Yii
    • Mono и Moonlight
    • Parallel Programming
    • Asterisk
    • Yandex API
    • WordPress
    • Sports programming
    • Lua
    • Microsoft SQL Server
    • Payment systems
    • TypeScript
    • Scala
    • Google API
    • Development of data transmission systems
    • XML
    • Regular expressions
    • Development under Tizen
    • Swift
    • MySQL
    • Geoinformation services
    • Global Positioning Systems
    • Qt
    • Dart
    • Django
    • Development for Office 365
    • Erlang/OTP
    • GPGPU
    • Eclipse
    • Maps API
    • Testing games
    • Browser Extensions
    • 1C-Bitrix
    • Development under e-commerce
    • Xamarin
    • Xcode
    • Development under Windows Phone
    • Semantics
    • CMS
    • VueJS
    • GitHub
    • Open data
    • Sphinx
    • Ruby on Rails
    • Ruby
    • Symfony
    • Drupal
    • Messaging Systems
    • CTF
    • SaaS / S+S
    • SharePoint
    • jQuery
    • Puppet
    • Firefox
    • Elm
    • MODX
    • Billing systems
    • Graphical shells
    • Kodobred
    • MongoDB
    • SCADA
    • Hadoop
    • Gradle
    • Clojure
    • F#
    • CoffeeScript
    • Matlab
    • Phalcon
    • Development under Sailfish OS
    • Magento
    • Elixir/Phoenix
    • Microsoft Edge
    • Layout of letters
    • Development for OS X
    • Forth
    • Smalltalk
    • Julia
    • Laravel
    • WebGL
    • Meteor.JS
    • Firebird/Interbase
    • SQLite
    • D
    • Mesh-networks
    • I2P
    • Derby.js
    • Emacs
    • Development under Bada
    • Mercurial
    • UML Design
    • Objective C
    • Fortran
    • Cocoa
    • Cobol
    • Apache Flex
    • Action Script
    • Joomla
    • IIS
    • Twitter API
    • Vkontakte API
    • Facebook API
    • Microsoft Access
    • PDF
    • Prolog
    • GTK+
    • LabVIEW
    • Brainfuck
    • Cubrid
    • Canvas
    • Doctrine ORM
    • Google App Engine
    • Twisted
    • XSLT
    • TDD
    • Small Basic
    • Kohana
    • Development for Java ME
    • LiveStreet
    • MooTools
    • Adobe Flash
    • GreaseMonkey
    • INFOLUST
    • Groovy & Grails
    • Lisp
    • Delphi
    • Zend Framework
    • ExtJS / Sencha Library
    • Internet Explorer
    • CodeIgniter
    • Silverlight
    • Google Web Toolkit
    • CakePHP
    • Safari
    • Opera
    • Microformats
    • Ajax
    • VIM
  • Administration
    • System administration
    • IT Infrastructure
    • *nix
    • Network technologies
    • DevOps
    • Server Administration
    • Cloud computing
    • Configuring Linux
    • Wireless technologies
    • Virtualization
    • Hosting
    • Data storage
    • Decentralized networks
    • Database Administration
    • Data Warehousing
    • Communication standards
    • PowerShell
    • Backup
    • Cisco
    • Nginx
    • Antivirus protection
    • DNS
    • Server Optimization
    • Data recovery
    • Apache
    • Spam and antispam
    • Data Compression
    • SAN
    • IPv6
    • Fidonet
    • IPTV
    • Shells
    • Administering domain names
  • Design
    • Interfaces
    • Web design
    • Working with sound
    • Usability
    • Graphic design
    • Design Games
    • Mobile App Design
    • Working with 3D-graphics
    • Typography
    • Working with video
    • Work with vector graphics
    • Accessibility
    • Prototyping
    • CGI (graphics)
    • Computer Animation
    • Working with icons
  • Control
    • Careers in the IT industry
    • Project management
    • Development Management
    • Personnel Management
    • Product Management
    • Start-up development
    • Managing the community
    • Service Desk
    • GTD
    • IT Terminology
    • Agile
    • Business Models
    • Legislation and IT-business
    • Sales management
    • CRM-systems
    • Product localization
    • ECM / EDS
    • Freelance
    • Venture investments
    • ERP-systems
    • Help Desk Software
    • Media management
    • Patenting
    • E-commerce management
    • Creative Commons
  • Marketing
    • Conferences
    • Promotion of games
    • Internet Marketing
    • Search Engine Optimization
    • Web Analytics
    • Monetize Web services
    • Content marketing
    • Monetization of IT systems
    • Monetize mobile apps
    • Mobile App Analytics
    • Growth Hacking
    • Branding
    • Monetize Games
    • Display ads
    • Contextual advertising
    • Increase Conversion Rate
  • Sundry
    • Reading room
    • Educational process in IT
    • Research and forecasts in IT
    • Finance in IT
    • Hakatonas
    • IT emigration
    • Education abroad
    • Lumber room
    • I'm on my way

To the question of speed and its measurement in Arduino

 3r3152. 3r3-31. To the question of speed and its measurement in Arduino
3r3138.  3r3152. The necessary note - I understand perfectly well that to measure the execution time of commands, you should use more complex programs, but for a rough estimate it is quite enough and such that will be demonstrated later. 3r3138.  3r3152. 3r3138.  3r3152. So, time is changing, and very significantly, looking for the causes of this phenomenon. First of all, we pay attention to the multiplicity of the obtained values, look at the description of the work with the time library and see that 4 microsec is a measurement quantum, therefore it is better to go over to the quanta and understand that we get 4 or 5 (very often) and 6 or 7 or 8 (very rarely) units of measurement. With the first half, everything is easy - if the measured value lies between 4 and 5 units, then the spread becomes inevitable. Moreover, considering the counts to be independent, we can increase the measurement accuracy by statistical methods, which we do, obtaining acceptable results. 3r3138.  3r3152. 3r3138.  3r3152. But with the second half (??8) things are worse. We found out that the spread does not correlate with the initial data, which means that this is a manifestation of other processes that affect the execution time of commands. Note that emissions are quite rare and are not significant for the calculated average value. It would be possible to ignore them altogether, but this is not our style. In general, over the years in engineering, I realized that it was impossible to leave neponyatki, no matter how insignificant they seemed, because they have the disgusting tendency to beat in the back (well, or even reach out) at the most inopportune moment. 3r3138.  3r3152. 3r3138.  3r3152. Begin pushing hypothesis 1 - the most convenient (in terms of convenience and versatility, it is second only to the direct intervention of the Creator) - software glitches, of course, not mine, my programs never buggy, but plug-in libraries (compiler, operating system, browser, etc. - substitute ). Moreover, since I run the program in the emulator on www.tinkercad.com , you can still refer to the emulator bugs and close the topic, because the source code is not available to us. Cons of this hypothesis:
 3r3152. 3r3138.  3r3152. 3r3333.  3r3152.
From cycle to cycle, the location of deviations varies, which hints. 3r3342.  3r3152.
This site still supports AutoDesk, although the argument is weak. 3r3342.  3r3152.
"We have accepted the postulate that what is happening is not a hallucination, otherwise it would simply be uninteresting." 3r3342.  3r3152.
3r3138.  3r3152. The following assumption is the effect of some background processes on the measurement result. It seems to be doing nothing, except as we believe, although we also output the results to Serial. Occurs hypothesis 2 - The output time is sometimes (strangely like that but everything happens) is added to the command execution time. Although it is doubtful how much of that output is there, but all the same - we add Flush and it did not help, we add a delay to the conclusion of the output and it didn’t help, we generally bring the output out of the cycle - still time jumps - this is definitely not Serial. 3r3138.  3r3152. 3r3138.  3r3152. Okay, what remains is the organization of the cycle itself (with what a fright it is to change its duration, it is not clear) and that’s all although micros () remained. I meant that the execution time of the first call of this function and the second one is the same when subtracting these two values, I get zero, but if this assumption is wrong? 3r3138.  3r3152. 3r3138.  3r3152. Hypothesis 3 - sometimes the second time reference is performed longer than the first one, or the actions related to time measurement sometimes affect the result. We look at the source code of the function of working with time (arduino-???hardwarearduinoavrcoresarduinowiring.c - I have repeatedly expressed my attitude to such things, I will not repeat) and see that 1 time out of 256 cycles of hardware increasing the younger part of the counter, an interrupt occurs to increment the older part counter. 3r3138.  3r3152. 3r3138.  3r3152. Our cycle execution time is from 4 to ? so we can expect 170 * (45) /256 = from three to four anomalous values ​​on a segment of 170 measurements. We look - it is very similar, there are really 4 of them. To separate the first and second reasons, we do the calculations with a critical section with forbidden interrupts. The result does not change much, outliers still take place, which means that extra time introduces a call to micros (). Here we can not do anything, although the source code is available, but we cannot change it - libraries are included in binary. Of course, we can write our own functions of working with time and watch their behavior, but there is an easier way. 3r3138.  3r3152. 3r3138.  3r3152. If the possible reason for the increase in duration is the "long" interrupt processing, we exclude the possibility of its occurrence in the measurement process. For this, we will wait for its manifestation and only then will we take a measurement cycle. Since an interrupt occurs much less frequently than our measurement cycle lasts, its absence can be guaranteed. We write the corresponding program fragment (using [s] Dirty hacks 3r3-366. Information extracted from the source code) and “this is such street magic”, everything becomes normal - we measure the execution time of 4 and 5 quanta with the average value of the execution time of the addition with the PT in 166 cycles, which corresponds to the previously measured value. The hypothesis can be considered confirmed. 3r3138.  3r3152. 3r3138.  3r3152. One more question remains - what is being done in interrupts for so long, that it takes 3r3138.  3r3152. (7.8) - (5) ~ 2 quantum = * 4 = 8 μs * 16 = 128 processor cycles? We turn to the source code (that is, the assembler code generated by the compiler on godbolt.com) and see that the interrupt itself runs approximately 70 cycles, of which 60 are permanent, and when reading there are additional costs of 10 cycles, totaling 70 when hit on interruption - less than received, but close enough. The difference is attributed to the difference between compilers or modes of their use. 3r3138.  3r3152. 3r3138.  3r3152. Well, now we can measure the actual execution time of the PT addition command with various arguments and make sure that it really changes greatly when the arguments change: from 136 cycles for 0.0 to 190 for ??? (magic number), and it is only 162 for ???. With a probability of 99.9%, this is due to the need for alignment and the peculiarities of its implementation in this particular library, but this study clearly goes beyond the limits of the problem under consideration. 3r3138.  3r3152. 3r3138.  3r3152.
The appendix is ​​the text of the program: r3r383. 3r3384.
3r3386. void setup ()
{
Serial.begin (9600); 3r3152.}
3r3152. volatile float t; //so it is necessary
3r3152. void loop ()
{
int d[170]; 3r3152. unsigned long time, time1; 3r3152. float dt = 1/170 .; 3r3152. 3r3152. for (int i = 0; i <170; ++i) {
{
//wait for the counter to overflow and interrupt processing
time1 = micros ();
long time2;
do {time2 = micros ();} 3r3r215. while (( time2 & ~ 0xFF) == (time1 & ~ 0xFF));
};
/** /
time1 = micros (); //mark the time 3r3152. /*
cli () //here there was an entrance to the critical section - did not help
* /
t = ???; //initial value for the operation 3r3152. t = t + dt; //measured operation 3r3152. /*
sei (); //completion critical sections
* /
time = micros (); //end time
time1 = time-time1;
d[i]= time1 /4;
/*
Serial. print (time1); //here are the results Ali
Serial.flush ();. //not helped remove
emissions Delay (20). //did not help
* /}
;
//derive the stored results, and consider derive average
float sum = 0; 3r3152. for (int i = 0; i <170; ++i) {
sum + = d[i];
Serial.println (d[i]);
};
Serial.println ((sum /170-???) * 4 * 16); //??? - obtained with an empty operation
Serial.flush (); //here we put a breakpoint to see the output graphs 3r3152.}
3r3137. 3r3r138.  3r3152. 3r3148. 3r3148. 3r3148. 3r3152. 3r3152. 3r3145. ! function (e) {function t (t, n) {if (! (n in e)) {for (var r, a = e.document, i = a.scripts, o = i.length; o-- ;) if (-1! == i[o].src.indexOf (t)) {r = i[o]; break} if (! r) {r = a.createElement ("script"), r.type = "text /jаvascript", r.async =! ? r.defer =! ? r.src = t, r.charset = "UTF-8"; var d = function () {var e = a.getElementsByTagName ("script")[0]; e.parentNode.insertBefore (r, e)}; "[object Opera]" == e.opera? a.addEventListener? a.addEventListener ("DOMContentLoaded", d,! 1): e.attachEvent ("onload", d ): d ()}}} t ("//mediator.mail.ru/script/2820404/"""_mediator") () (); 3r3146. 3r3152. 3r3148. 3r3152. 3r3152. 3r3152. 3r3152.

It may be interesting

  • Comments
  • About article
  • Similar news
This publication has no comments.

weber

Author

19-10-2018, 06:23

Publication Date

Development / Programming

Category
  • Comments: 0
  • Views: 285
C vs Go cycles and simple math
Who is responsible in agile for the
Chinese artificial sun
Alternative search engines VS. Yandex
Writing OS: Multitasking
10 physical facts that you should have
Write a comment
Name:*
E-Mail:


Comments
Inursing test bank was very pleased  to find this site.I wanted to thank you for this great read!! I definitely  enjoying every little bit of it and I have you bookmarked to check out new  stuff you post.  
Today, 18:20

taxiseo2

You completed certain  reliable points there. I did a search on the subject and found nearly all  persons will agree with your blog.  
nursing test bank
Today, 18:04

taxiseo2

Great post i must say  and thanks for the information. Education is definitely a sticky subject.  However, is still among the leading topics of our time. I appreciate your  post and look forward to more.
nursing test bank
Today, 17:29

taxiseo2

So good! This web post provides knowledge, knowledge, good news, and is very useful. Thank you for everything Taxi Driver Jacket
Today, 15:35

MalenaMorgan

I know this is one of the most meaningful information for me. And I'm animated reading your article. But should remark on some general things, the website style is perfect; the articles are great. Thanks for the ton of tangible and attainable help.2movierulz

Today, 15:34

raymond weber

Adv
Website for web developers. New scripts, best ideas, programming tips. How to write a script for you here, we have a lot of information about various programming languages. You are a webmaster or a beginner programmer, it does not matter, useful articles will help to make your favorite business faster.

Login

Registration Forgot password