-
An App Budget for America
If you’ve been paying any attention to the news this week, you will of course know about the major snafu in the Iowa Democratic Caucus. It is now largely being blamed on what appears to be a bug in the app developed by a for-profit third party company. I’ve been reading the news around this with quite a bit of interest both because I’m interested in our democratic process, but also because I have a small bit of idea what the app developer is going through. I’ve been an engineer on apps since the early days of the Palm Pilot, way back in 1999. (They weren’t even called apps back then!) As such, I’ve been on hundreds of 1.0 product launches, many of which have been amazingly successful, but I’ve also had my share of painful and embarrassing failures so I certainly cannot throw too many stones from within my glass house.
However, the thing that really caught my attention was the reported development cost of the app. It has been widely reported that the Iowa Democratic Party paid the app developer $63,000 for this product. In particular, I noticed more than a few news outlets reporting that it was a large sum of money. To an individual, $63,000 is certainly a lot of money but in the context of an app development project, it is a very meager, thin budget.
As app developers, we don’t often talk about all the costs that go into a platform like this, but given the gravity of this app, I consider this to be far too small of a budget. If you’ve ever wondered what goes into developing an app and how much it might cost, I think this is a great opportunity to break it down. If we are following any sort of sane development model, we will do the following:
- Gather the user and technical requirements of the platform
- Design the user interface and user experience so that precinct captains who are going to have to use the app can do so with very little assistance
- Develop the backend server and database that the apps will talk to
- Develop some sort of dashboard or web interface for retrieving the data that has been uploaded by the apps
- Develop an iOS app
- Develop an Android app
- Test the apps and server in a controlled quality assurance environment
- Deploy the apps and server to a production environment
- Have a beta test period to validate the system is operating correctly and that users can download and utilize the product
- Launch the product!
Now that we have the staffing established, let’s figure out how much time these folks are going to be working on the project. First, we need to establish a rough timeline. For an app like this, I would roughly estimate that it would consist of a month of up front work defining the requirements and interface followed by 2-3 months of active development, followed by at least 1 month of quality assurance. At that point, the app is hopefully well written and tested and ready to move to a beta test period which should, at a minimum, take 2-4 weeks. In the end we should have a project timeline that is going to run at least 5-6 months. Now we need to figure out how much time each person on this team is going to spend working on this product.
Let’s start with the project manager. In general, the project manager is going to be the source of continuity through the entire project. They are going to work heavily up front with the client (in this case the Iowa Democratic Party) and the designer defining the requirements and translating those requirements into a user interface that will meet the needs of the diverse population that will use this app. The users of this app are going to have an incredibly broad range of technical sophistication so it will be important that the UI/UX be done well. The project manager will then transition to part time during the development phase as they coordinate the many moving parts of the project. As the development phase wraps up, they will then re-engage as the product goes into the testing, deployment and beta testing phases. Given our assumptions above, they would likely spend about 1 month working with the client and the designer up front to define the product, then transition to approximately 1/4 time during the development phase and then transition to 1/2 time during the testing phase, followed by a full time engagement during beta testing. Roughly speaking, the project manager would need to be budgeted for about 3.25 months over the course of the project.
While the project manager’s involvement is a bit dynamic, the designer is a little easier to estimate. They will likely spend the majority of their time at the beginning of the project creating the user interface and user experience for the app, and then they will spend a little time during the quality assurance phase ensuring that their initial designs were successfully translated to the product. Generally speaking, the designer should be budgeted for about 1 month during the project.
Next up is the server/database developer. This one is a little more difficult to estimate since it is unclear where the caucus data needs to go once it’s uploaded, but at the very least we know that it needs to provide login and authentication functionality as well as data storage and reporting. In general, the server developer will need to define the interfaces that the apps talk to as well as provide development, test and production environments for the different phases of the project. As a conservative estimate, let’s assume that the server developer works for approximately 2 months during the course of the project.
The app developers on the project will obviously need to be fully active during the primary development phase, but even more importantly, they need to be fully engaged during the testing phase and at least partially available during the beta testing phase. As a conservative estimate, we can budget them for approximately 3.5 months of the project. Since we need an iOS and an Android app, we need to budget a combined 7 months for the project.
Finally, we need to consider the QA engineer’s contribution. In a perfect world, the quality person is a team of people and they are at least partially engaged from day 1 of the project. However, we will employ a conservative estimate and budget only a single person for just the testing phase of the project, which is 1 month.
So with all of that out of the way, we can come up with the following time estimate:
- Project manager - 3.25 months
- Designer - 1 month
- Server developer - 2 months
- iOS developer - 3.5 months
- Android developer - 3.5 months
- Quality assurance engineer - 1 month
I cannot say exactly what development plan this company followed and I cannot say how they staffed it, (although some details are starting to emerge). I also cannot say if the app developer had a longer play in mind when developing the app in terms of a profit model. For example, it is likely they could have charged the Iowa Democratic Party less than the actual cost of development with the intention of reusing the platform for other states and recouping more of their initial costs. (The Nevada Democratic Party apparently paid them for an app as well, so this is a likely possibility.) The one thing I can definitively say, however, is that for an app of this level of importance, $63,000 is not a very large budget. Given the vast amounts of money that campaigns raise, it seems like this would almost end up equivalent to a rounding error.
-
Seven Secret Benefits of Remote Work Revealed!
Companies that embrace remote teams can reap numerous benefits: employee engagement drastically improves, employee retention increases, and the available talent pool grows immensely when not tied to a single geographical location.
There are many benefits to remote employees as well. Some are obvious, but some are not so obvious. Below are seven benefits to remote employees that you may not know!
- Your compost and garbage bins will be emptier. When your home refrigerator is your work refrigerator, leftovers don't spoil nearly as often which means less going into your waste bins.
- Streaming movies will load more quickly and stutter less. The high-speed Internet you need for your video conferencing just so happens to also help your Netflix streaming in the evenings.
- You will help fight piracy. There is a special place in hell for porch pirates (people that steal holiday gifts from people's doorsteps.) During the holidays you will feel so much better knowing that you will definitely be home when UPS knocks on the door to deliver packages.
- You will be prepared when fashion styles from the previous decade come back in vogue. Because you don't have to keep re-investing in clothing for meetings or to impress co-workers, your wardrobe will last quite a bit longer. Eventually, that neon shirt that you wear on days when you don't have a video conference call will suddenly be chic.
- You will save immense amounts of money on personal hygiene products. Getting low on razors? You can push that stubble a little longer. Running out of foundation? No video calls today so no problem. Did you forget to get deodorant the last time you were at the store? Nobody can smell you on a conference call!
- If you have children, their grades will go up. Because you are consistently available to chaperone events at school, you will develop a rapport with your children's teachers which will inevitably lead to more lenient grading and better engagement at school
- You will improve national security. If you don't have a commute, you're not burning fossil fuels trying to get to work which means your country will be less reliant on foreign oil reserves.
-
Time, Relativity and Distributed Companies
“The only reason for time is so that everything doesn’t happen at once.” -Albert Einstein
One of the most difficult parts of communication within a fully distributed company is dealing with timezones. I can’t count the number of times that someone has emailed me asking “Can we have a meeting at 10 a.m.?” The obvious question here is which 10 a.m. are you asking about? Are you asking about your 10 a.m. or my 10 a.m.? Unfortunately, it feels pedantic to ask the person to clarify what they mean, but it matters if you want everyone to show up at the same moment in time!
As I’ve mentioned before, we use Slack in place of meetings for a lot of internal communication, but we do still need to jump on phone calls from time to time. One of the skills that I’ve had to learn when trying to setup meetings is to be very explicit about the time that you mean. Think it’s easy? Try this quick little quiz. Figure out what time it is right now in the following U.S. cities, without using a map:
- Las Vegas
- Nashville
- New Orleans
- Phoenix
- Detroit
- Cleveland
- Louisville
- Pittsburgh
- Milwaukee
- Boise
“Are you available for a call at 11:00 a.m. Pacific (1:00 p.m. Central)?"
By communicating it this way, I’m communicating to you that:
- We are not both in the same timezone
- I would like to talk to you at 1:00 in the afternoon
- It will still be 11:00 in the morning for me
-
Distributed Companies Are Real
When we first set out to build Silverpine, we didn't really have much of a plan. All we knew was that the fates had aligned, and that it was our time to set out on our own. From our very first day, we have managed to bootstrap the business which was ultimately very beneficial, however, bootstrapping is hard. Very hard. While we grappled with unknown cashflows and even more unknown project pipelines, we knew we had to scrimp and save and keep our costs as low as we possibly could. One major way we were able to do that was by making Silverpine a "virtual" business in that we had no physical office space. It also didn't hurt that neither my partner Ryan nor I wanted a commute, so it definitely felt like a win/win situation.
For the first few years of our existence, our staff consisted of only Ryan and myself and an occasional subcontractor or two. Working remote became an unstated, simple to implement company policy that we grew to appreciate implicitly, and the freedom that it lent to us quickly became a de facto benefit. As we grew as a company, however, the true value began to emerge.
When we finally hired our first full time employee, working remotely was still an implied benefit. At the same time, we started noticing a trend that many of the best engineers and developers that we knew were explicitly looking for new positions with significant remote work opportunities. However, when our first employee notified us that she was going to move to a rural area, it truly started to dawn on us what it meant for recruiting and retainment. Suddenly, this quirky company policy, that had just organically happened, had become an important pillar of our company culture.
At that point, Ryan and I decided that we were going to commit to Silverpine being a fully distributed organization. We abandoned any intention of developing a physical footprint and started viewing our evolving company through that lens. As we continued to grow and hire, I had to unlearn some of the things that had been ingrained in me from my time in the corporate world and from my MBA classes. I had to really dig in to understanding the tradeoffs of being distributed, partially because we needed to adopt tools and policies that would work well for remote employees, but also because we needed to be able to speak to our clients about how we were different from similar agencies and ultimately, why our distributed nature would benefit them.
For a long time, whenever a prospective client would ask us where we were located, I would make some sort of joke that we were following the "IBM model" even though it wasn't really an accurate comparison. I would then do some general hand waving about what that meant, but more often than not, I was left with the distinct feeling that we were sometimes viewed as not being a legitimate company. Because of my approach to communicating our structure, I'm certain that we lost more than a couple bids on projects because of this.
Fortunately, as time progressed, many other companies started to legitimize remote work. Companies like Automattic, Basecamp, InVision and Zapier have literally written the book on how to have a remote team, and they have shown that it can work at scale. People have started to notice how these companies operate and thrive, and maybe most importantly, many of the best engineers and developers have started to view remote opportunities as a non-negotiable job requirement. I have run into people time and again at conferences and other work-related events where they explain that having a remote position is often times more important than a salary bump. That means that there is an actual, tangible economic value to a company that embraces remote work.
For Silverpine, we have become better at articulating the legitimacy of our remote nature in a way that better portrays it as a competitive advantage. We talk about the engagement and happiness levels of our employees. We talk about the quality of communication that our team practices on a daily basis. And, we talk about lower base costs which translates to lower project costs. We also occasionally talk about the tools and the processes and the intentionality of it that helps craft our company culture. All of this is important in explaining our story and our organization because there are still plenty of people with an incorrect understanding of remote companies.
I am convinced that the model we stumbled upon (but ultimately embraced) is a blueprint for long term success. It allows us a flexibility and nimbleness that other corporations simply can't match, and in the ever-changing world that we live in, flexibility is a survival trait. As the Japanese proverb states: "The Bamboo that bends is stronger than the Oak that resists."
We are definitely still learning and adapting how we function and operate, but I no longer act sheepish or apologize for being a remote company. I am proud of what we are building and what Silverpine has become. (It also doesn't hurt that our track record is pretty great!) So, if you are thinking about working at a remote company or thinking about adopting remote-friendly policies, don't approach it as some odd-ball thing. Take some time and read about what/how other companies that are doing it, and recognize that distributed companies are real.
-
Tools for a Distributed Software Agency
One of the things that I am most proud of is that Silverpine is a 100% distributed company. Often when people find out that we are fully remote, they will ask curiously about what tools we use to work together. This is completely understandable because the importance of having the right tool set is magnified for remote companies. We understand this innately and as such we are constantly evaluating our software stack. The following list represents the software that powers our business. (I have intentionally omitted some of the lower level development tools like Xcode and Android Studio.) The list is broken into four primary classifications: communication, development, project execution, and finance.
Communication
Slack
Before Slack, we used a hodge lodge of messaging tools like AIM, Google Chat and even old school SMS. It was horrible. Slack is the single most important tool that we use to communicate with each other and with our clients. All of our employees and contractors use it extensively every day, and even though I think that there should be some middle ground in their pricing between the paid and the pro plans, I can't imagine trying to work remotely without it.Webex
Let me just preface this by clarifying that I think that every single conference calling platform is terrible. I have used them all. From Zoom.io to Google Hangouts to AT&T Connect, they are just barely workable. Besides the all too common call drops they also all seem to suffer from ridiculous installation processes and byzantine user interfaces (Does this yellow button state mean my microphone is on mute or can they hear me?)That being said, we have been using Webex for a very long time; not because it is good, but because it is better than the alternatives. And for our enterprise clients, it is somewhat of a known entity so we seem to spend less time per call doing the “can you hear me” dance. I wouldn’t say that I recommend Webex. It’s just what we use.
Dropbox Pro
We have been using Dropbox on personal plans for quite a while, but we recently decided to standardize on Dropbox Pro for file sharing. All of our projects have quite a bit of documentation, graphical assets and other large files that aren't well suited for source control tools. Dropbox allows us to create per project file drops that we can easily access as well as share with other people when appropriate. We almost switched to Box.com because their pro plans have unlimited storage but ultimately decided it would be less transitional headache to just upgrade our existing Dropbox plans.G Suite
We have been using Google for our email and calendar services for so long that our silverpinesoftware.com domain is still functioning under the original beta operating agreement. If G Suite disappeared I honestly wouldn't even know where to start looking for a replacement. File this one under "it just works."Development
InVision
One of Silverpine's guiding design principles is that every user interface needs to have a beautiful "feel" to it, and that you simply can't judge the feel of an app until you can hold it in your hand and interact with it. Because of this philosophy, we have refined our development process over time to rely heavily on InVision to prototype the UI and UX of our apps before we ever even start writing code. The amount of time and pain it saves both us and our clients cannot be overstated. If you design for mobile, you really should be using InVision or something like it.GitHub
If you write software, you should be using a source control platform. If you need a source control platform you should be using GitHub. If you're using something else, I'm sure you have a reason for it, but it's probably not a very good reason. (All of our projects use GitHub repositories so when they changed their pricing model to be per user rather than per repository, it made our lives a lot easer.)Azure DevOps
This one might surprise some people, but a couple years ago we transitioned to what is now known as Microsoft Azure DevOps for our automated build system and have been using it ever since. Prior to Azure DevOps we had used a variety of tools including TestFlight (bought by Apple), Fabric (bought by Twitter, then bought by Google), and BuddyBuild (ran out of money). Due to intense consolidation in that particular sector, we were frequently having to retroactively change our toolset which was both time consuming and costly. A friend of mine who works on the Microsoft tools team encouraged us to give Azure DevOps a try, and we have been extremely happy with that decision. Azure DevOps supports both iOS and Android, is massively configurable, has 24/7 support and most importantly, is backed by one of the largest companies in the world so it won't be disappearing any time soon. If you need an automated build system and haven't taken a look at Azure, I highly recommend at least kicking its tires.Project Execution
Basecamp
For many years, we wandered in the desert of project management, largely piggybacking on whatever project management tools our clients happened to be using at the time. As such, we have used everything from Jira to Asana to Microsoft Excel to track projects and tasks. However, in the past year we have implemented Basecamp as our standard internal project tracking tool. One of the things I like best about Basecamp is that it has clearly been thoughtfully designed. Not only is it powerful, but its design somehow works to ensure that it doesn't become overly burdensome in the same way that other similarly complex tools do.Lighthouse
If there was one piece of web software that I would invest internal Silverpine resources on, it would be a lightweight bug tracking tool. There just aren't many platforms out there that can strike a balance of utility and ease of use that errs on the side of ease of use. For now, Lighthouse foots the bill for us in that regard, however, I'm not sure how much longer it will be around. There hasn't been any significant development done on it in the 6+ years that we've been using it, so I'm not sure I would necessarily recommend it. That being said, it does what we need bug tracking software to do, and it does it well, and I haven't found a replacement. If you have any personal favorites, please let me know.Finance
Blinksale
Silverpine is a services business and sending invoices to our customers is literally how we are able to make money. Blinksale is the tool we use to send those invoices and look like we are professionals in the process. While it isn't a complex tool, it expertly does what we need it to do: send and track professional looking invoices. If you send invoices to clients, you really should be using a tool like Blinksale because people can tell when you don't.Quickbooks
Nobody really loves Intuit. They have created not one, but two near monopolies with TurboTax and Quickbooks. However, if you run a business, you need to track your finances in a way that your CPA can help you with your taxes at the end of the year, and if you tell your CPA that you use anything other than Quickbooks, they will not be happy with you and they will very likely take longer to do your taxes which means you will end up with a higher bill from them. That is the reality of Quickbooks and that is why we use it.Gusto
If you have employees or sub-contractors that you need to pay, you really should be using Gusto. The folks at Gusto are wizards when it comes to dealing with payroll taxes and W-9's and a great deal more things that I simply don't have to worry about because we use their service. Not only is the Gusto platform super easy to use, but their customer service team is actually pro-active in notifying us of upcoming tax law changes that might affect us. I am continually in awe of how great Gusto is and cannot say enough good things about them. -
Unintended Consequences
Disclaimer: This post comes from my old blog back in 2004. I’m reposting it here so that I don’t lose the content. The source was hand-written HTML so the formatting probably appears a bit off.
About seven years ago I wrote some code to do Mu-Law and A-Law compression. About six years ago, I decided to publish an article along with the source code for it. You can find it here. Anyway, the other day I received an email from someone who had taken it and modified it for what he was doing. In doing so, he found a piece of misinformation that has been in my article since I originally published it. Not a big deal, and I intend to rectify the issue. However, as we chatted over email, I asked him what he was using Mu-Law/A-Law compression for. Here is a clip from our email:
> So if you don’t mind me asking, what are you working on that has 13 bit
> unsigned audio input?
Sure. I am designing a system that monitors lots of radio stations to capture and
detect Emergency Alert System activations - those ugly tones and occasional
voice messages you hear on the radio. The system has some rather incredible
shortcomings for a critical system in 2005. When the emergency management
office triggers an alert they have no way of knowing whether or not radio stations
actually broadcast the alert. Sometimes the system fails - too often. So our
system listens to the stations and sends a report back to Emergency HQ. In
most cases an exception report that shows which stations did not properly
send out the alert. So if the dam is breaking or the nuke is going critical they
can try again, use the phone, send a helicopter or something.
Whoa. Code that I originally wrote to compress audio in children’s games is now being used to help monitor Emergency situations. Talk about your unintended consequences!
-Jon
-
Translating Hardware Exceptions to C++ Exceptions
Disclaimer: This post comes from my old blog back in 2004. I’m reposting it here so that I don’t lose the content. The source was hand-written HTML so the formatting probably appears a bit off.
No matter how careful of a programmer you are, there will always be times when a hardware exception will occur in your code. Perhaps it was a third party component that was the culprit. Perhaps, it was a fellow co-worker that broke something. Or maybe it was Microsoft itself not playing fair with its documentation and/or implementations. Whatever the case, it is often very useful to be able to capture a run-time exception that was generated by the CPU. Sure, you can use a catch(...) to be your fail-safe, but wouldn't it be great to be able to convert that exception that was generated by the hardware into a C++ exception? I created this class in order to do that very thing. In fact, this class was the basis for my super assert that I created, because I found that I could cause a hardware exception any time I wanted, and by using this C++ hardware exception container, I could access each thread's stack frame at run-time. This would eventually enable me to perform a stack trace inside of an assert, but I will explain that more in a different tutorial.
Anyway, I hope that this is useful to someone. I spent a while digging around in the mire that is Microsoft's documentation before I put this together. Perhaps this will save someone else time in the future.
Enjoy.
-BossHogg
#ifndef HARDWARE_EXCEPTION #define HARDWARE_EXCEPTION 1
enum HWExceptionType { eIllegalMemoryAccess = EXCEPTION_ACCESS_VIOLATION, eUnexpectedBreakpoint = EXCEPTION_BREAKPOINT, eDataTypeMisalignment = EXCEPTION_DATATYPE_MISALIGNMENT, eSingleStepInstruction = EXCEPTION_SINGLE_STEP, eArrayBoundsExceeded = EXCEPTION_ARRAY_BOUNDS_EXCEEDED, eDenormalFloat = EXCEPTION_FLT_DENORMAL_OPERAND, eFloatDivideByZero = EXCEPTION_FLT_DIVIDE_BY_ZERO, eFloatInexactResult = EXCEPTION_FLT_INEXACT_RESULT, eFloatInvalidOperation = EXCEPTION_FLT_INVALID_OPERATION, eFloatOverflow = EXCEPTION_FLT_OVERFLOW, eFloatStackCorrupted = EXCEPTION_FLT_STACK_CHECK, eFloatUnderflow = EXCEPTION_FLT_UNDERFLOW, eIntDivideByZero = EXCEPTION_INT_DIVIDE_BY_ZERO, eIntOverflow = EXCEPTION_INT_OVERFLOW, ePrivelegedInstruction = EXCEPTION_PRIV_INSTRUCTION, eUncontinuableException = EXCEPTION_NONCONTINUABLE_EXCEPTION };
class HWException { public: HWException(HWExceptionType aType, EXCEPTION_POINTERS* pExp): itsCategory(aType), itsPointers(pExp), itsLocation(pExp->ExceptionRecord->ExceptionAddress) { }
HWExceptionType GetCategory() const {return itsCategory;} DWORD GetLocation() const {return itsLocation;} EXCEPTION_POINTERS* GetSysPointer()const {return itsPointers;} protected: HWExceptionType itsCategory; DWORD itsLocation; EXCEPTION_POINTERS* itsPointers;
};
static void HWTranslateException(unsigned int u, EXCEPTION_POINTERS* pExp) { throw HWException((HWExceptionType)u,pExp); }
#endif
/////////////////////////////////////////////////////////////////////// Example usage: ///////////////////////////////////////////////////////////////////////
#include “windows.h” #include “HWException.h”
int main() { //Note, setting the exception translator must be done //on a per thread basis. _set_se_translator(HWTranslateException);
try { //This will cause an access violation char* ptr = NULL; *ptr = 5; } catch (HWException& e) { //We can now know both the type and the //memory location of the instruction that //caused the exception. Cool! HWExceptionType exceptionType = e.GetCategory(); DWORD address = e.GetLocation(); } catch (...) { //If we got here, then it was some other kind //of C++ exception... } return 0;
}
-
CPU Detection Code
Disclaimer: This post comes from my old blog back in 2004. I’m reposting it here so that I don’t lose the content. The source was hand-written HTML so the formatting probably appears a bit off.
CPU Detection Code
I dug this code up from a project that I worked on a long time ago. Unfortunately, it is woefully out of date, especially with any of the latest P4 processors. Also unfortunately, I don't have a large suite of machines on which to test this, however, I have verified a large number of these, but not all. Also missing from the list are any AMD processors since my old companies didn't explicitly support AMD. Oh, well. As always, this code is to be used at your own expense, and I guess with this particular set of code, that means a little more. Anyway, I hope someone finds this interesting, and if you have any questions, feel free to ask.
-BossHogg
#include "windows.h"
bool QueryCPUID();
bool QueryMMX();
bool QueryHyperThreading();
void QueryVendorString(char* string);
bool QuerySerialNumber(char* string);
void GetCPUInfoString(char* string);
unsigned long QueryCacheSize();
unsigned long QueryCPUCount();
unsigned char QueryCPUModel();
unsigned char QueryCPUFamily();
unsigned char QueryCPUStepping();
unsigned char QueryCPUType();
bool Is8086()
{- int is8086=0;
- __asm {
- pushf
- pop ax
- mov cx, ax
- and ax, 0fffh
- push ax
- popf
- pushf
- pop ax
- and ax, 0f000h
- cmp ax, 0f000h
- mov is8086, 0
- jne DONE_8086_CHECK
- mov is8086, 1
- DONE_8086_CHECK:
- };
- return !!is8086;
}
bool Is80286()
{- int is80286=0;
- __asm {
- smsw ax
- and ax, 1
- or cx, 0f000h
- push cx
- popf
- pushf
- pop ax
- and ax, 0f000h
- mov is80286, 1
- jz DONE_80286_CHECK
- mov is80286, 0
- DONE_80286_CHECK:
- };
- return !!is80286;
}
bool Is80386()
{- int is80386=0;
- __asm {
- pushfd
- pop eax
- mov ecx, eax
- xor eax, 40000h
- push eax
- popfd
- pushfd
- pop eax
- xor eax, ecx
- mov is80386, 1
- jz DONE_80386_CHECK
- mov is80386, 0
- DONE_80386_CHECK:
- };
- return !!is80386;
}
bool QueryCPUID()
{- int hasCPUID=0;
- __asm
- {
- pushfd
- pop eax
- mov ecx, eax
- and ecx, 0x00200000
- xor eax, 0x00200000
- push eax
- popfd
- pushfd
- pop eax
- and eax, 0x00200000
- xor eax, ecx
- mov hasCPUID, eax
- };
- return !!hasCPUID;
}
bool QueryMMX()
{- bool canDoMMX=false;
- __asm
- {
- mov eax, 1 ; request for feature flags
- _emit 0x0F ; CPUID on Pentiums is 0f,a2
- _emit 0xA2
- test edx, 0x00800000 ; is MMX technology Bit(bit 23)in feature
- jz DONE_MMX_CHECK ; flags equal to 1
- mov canDoMMX,1
- DONE_MMX_CHECK:
- };
- return canDoMMX;
}
bool QueryHyperThreading()
{- unsigned int regEdx = 0;
- unsigned int regEax = 0;
- unsigned int vendorId[3] = {0, 0, 0};
- if (!QueryCPUID())
- return false;
- __asm
- {
- xor eax, eax // call cpuid with eax = 0
- cpuid // Get vendor id string
- mov vendorId, ebx
- mov vendorId + 4, edx
- mov vendorId + 8, ecx
- mov eax, 1 // call cpuid with eax = 1
- cpuid
- mov regEax, eax // eax contains family processor type
- mov regEdx, edx // edx has info about the availability of hyper-Threading
- }
- if (((regEax & 0x0F00) == 0x0F00) || (regEax & 0x0F00000))
- {
- if (vendorId[0] == 'uneG' && vendorId[1] == 'Ieni' && vendorId[2] == 'letn')
- {
- return !!(regEdx & 0x10000000);
- }
- }
- return false;
}
void QueryVendorString(char* string)
{- char vendorId[12];
- int is8086=0;